• Resolved derderderder

    (@derderderder)


    How can I set after a successful SEPA charge (I know that the payment takes some days) the status automatically in “processing” and not to “waiting”?

    Background: I sell tickets and if a SEPA payment fails, I have plenty of time to lock the tickets but I want that every user get the tickets instantly

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter derderderder

    (@derderderder)

    Here my solution which I adapted from another thread:

    add_action( ‘wc_gateway_stripe_process_response’, ‘action_wc_gateway_stripe_regard_sepa_pending_as_complete’, 0, 2);
    /**
    * Action function that sets the order to “payment completed” even if the SEPA direct debit is pending at Stripe.
    * @author Kai Mindermann
    */
    function action_wc_gateway_stripe_regard_sepa_pending_as_complete ($response, $order) {

    // check if payment (stripe response) is in pending state
    // check if payment (stripe response) is of ‘sepa_debit’ type
    // check if order contains a subscription
    if( $response->status === ‘pending’ && $response->source->type === ‘sepa_debit’) {
    $order->payment_complete($response->id);

    /* translators: response id */
    $order->add_order_note( sprintf( __( ‘Pending status automatically set as payment complete by custom hook (Charge ID: %s)’, ‘woocommerce-gateway-stripe’ ), $response->id ) );
    if ( is_callable( array( $order, ‘save’ ) ) ) {
    $order->save();
    }
    }
    // TODO update post_meta?
    // TODO update fees
    }

    There seems to be an extension for this (that uses the exact same code as above, because it originates from it or at least from that author): https://github.com/kmindi/wc-stripe-asynchronous-payments-pending-to-payment-complete Pending Payments to Payment Complete for WooCommerce Stripe Payment Gateway

    Thread Starter derderderder

    (@derderderder)

    Is there a way to send with this solution the “payment ok” mail like the native paypal implementation? My problem is that SOFORT and GIROPAY is async here. So the user gets only a order confirmation with the link to the payment and after the payment is complete, no additional mail is send. As I send tickets in the order confirmation, the user don’t get the tickets because in the moment of the confirmation mail, the order is not payed and the tickets are not issued.

    The native paypal integration sends after the IPN an additional mail which I assume is called “payment ok”. I don’t know how to trigger this email in the hook. Can anyone help?

    A direkt implementation of this feature in the plugin would be really great…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘SEPA auto ok’ is closed to new replies.