{"id":14652513,"date":"2021-07-12T18:03:23","date_gmt":"2021-07-12T18:03:23","guid":{"rendered":"https:\/\/wordpress.org\/support\/?post_type=topic&#038;p=14652513"},"modified":"2021-07-12T18:10:59","modified_gmt":"2021-07-12T18:10:59","slug":"set-status-to-completed-after-charge-succeeded-is-recieved","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/set-status-to-completed-after-charge-succeeded-is-recieved\/","title":{"rendered":"Set status to completed after Charge.succeeded is recieved"},"content":{"rendered":"<p>Because i use Woo Subscriptions i would like to skip the on-hold status to set the subscription to active.<br \/>\nSo the order then would be in the &#8216;processing&#8217; status.<br \/>\nIs there a way to automaticly set the order to &#8216;completed&#8217; if the Webhook Charge.succeeded is recieved?<br \/>\nIs there any action the i could use and is there a variable where i could get the status of the charge?<br \/>\nAnd would this interfere with the plugin in any way?<\/p>\n<p>Normally i could just skip the processing status but i can&#8217;t do that here because of the subscriptions, because i would like to have a status to reflect that the payment is still pending. Otherwise i could just skip to &#8216;completed&#8217;.<\/p>\n<p>Right now im skipping the on-hold status like this:<\/p>\n<pre><code>add_action( &#039;woocommerce_order_status_changed&#039;, &#039;wc_order_processing_SEPA&#039;, 10, 4 );\nfunction wc_order_processing_SEPA( $order_id, $status_from, $status_to, $order ) {\n    if($order-&gt;get_payment_method() === &#039;stripe_sepa&#039; &amp;&amp; $status_to === &#039;on-hold&#039;) {\n        $order-&gt;update_status( &#039;processing&#039; );\n    }\n}<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-14652513","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14652513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14652513\/revisions"}],"predecessor-version":[{"id":14652543,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14652513\/revisions\/14652543"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=14652513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}