• Resolved Themes4Free

    (@themes4free)


    How can I change the status after payment via SOFORT instead of on-hold automatically in processing.

    I know that the status will be set automatically via API, if Stripe received the money, but I would like to have it on Processing immediately after Payment via customer.

    I think here only one file has to be adjusted, but I have not found it yet.

    Excuse my bad English.

    Greeting
    Falk

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Mike M. a11n

    (@mikedmoore)

    Automattic Happiness Engineer

    Hi Falk,

    You would likely need to first run a check that the gateway was indeed SOFORT, then update run update_status(). You can find an example here – https://stackoverflow.com/questions/22935358/woocommerce-change-order-status-with-php-code

    Thread Starter Themes4Free

    (@themes4free)

    Hello Mike,

    thanks for your answer!

    I think i must change a little bit in the class-wc-stripe-webhook-handler.php

    In this area!?

    public function process_webhook_charge_succeeded( $notification ) {
    		// The following payment methods are synchronous so does not need to be handle via webhook.
    		if ( ( isset( $notification->data->object->source->type ) && 'card' === $notification->data->object->source->type ) || ( isset( $notification->data->object->source->type ) && 'three_d_secure' === $notification->data->object->source->type ) ) {
    			return;
    		}
    
    		$order = WC_Stripe_Helper::get_order_by_charge_id( $notification->data->object->id );
    
    		if ( ! $order ) {
    			WC_Stripe_Logger::log( 'Could not find order via charge ID: ' . $notification->data->object->id );
    			return;
    		}
    
    		$order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
    
    		if ( 'on-hold' !== $order->get_status() ) {
    			return;
    		}
    
    		// Store other data such as fees
    		WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, '_transaction_id', $notification->data->object->id ) : $order->set_transaction_id( $notification->data->object->id );
    
    		if ( isset( $notification->data->object->balance_transaction ) ) {
    			$this->update_fees( $order, $notification->data->object->balance_transaction );
    		}
    
    		if ( is_callable( array( $order, 'save' ) ) ) {
    			$order->save();
    		}
    
    		/* translators: transaction id */
    		$order->update_status( $order->needs_processing() ? 'processing' : 'completed', sprintf( __( 'Stripe charge complete (Charge ID: %s)', 'woocommerce-gateway-stripe' ), $notification->data->object->id ) );

    After Order the status change to pending payment, when the customer pay, its change to on hold and after Stripe become the money its change to processing.

    But i will, its change immediately after pay to processing, whitout the step on hold.

    Plugin Support stephjacq a11n

    (@stephjacq)

    Automattic Happiness Engineer

    Hi there, we do not recommend making changes to the Stripe plugin code itself.

    You could hook into the woocommerce_thankyou hook and run custom function that will set orders to processing using update_status().

    This is heading towards a very custom solution; please consider reaching out to one of our vetted developers on our Customizations page (https://woocommerce.com/customizations/) or join the WooCommerce Slack Community (https://woocommerceslack.herokuapp.com).

    Plugin Support Mike M. a11n

    (@mikedmoore)

    Automattic Happiness Engineer

    Hi there,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Order Status via SOFORT – On-Hold in Processing’ is closed to new replies.