Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    Do you know if it works with Stripe ?
    Thank

    Thread Starter Daniel Loureiro

    (@loureirorg)

    I’m not sure, but if it doesn’t, you can do your own implementation using:
    1) $order = wc_create_order(...) to generate an order based on the current user cart;
    2)$gateways = WC()->payment_gateways->get_available_payment_gateways(); to get the WC’s gateway options;
    3) $gateways['stripe']->process_payment( $order->get_id() ) to process the payment;

    The result of #3 is an object containing an URL, just like this plugin would do. On your app, you should open this URL, which will lead the user to Stripe’s payment page. Once user pays it, Stripe will communicate with your WooCommerce site using webhooks, which will automatically update the order status.

    Of course, you will have to wrap this logic with WordPress’ REST API or Ajax API, so it can be accessible via a REST call. The code should be either put in your theme’s functions.php or in a new plugin you create.

    This can be a bit complex, but it’s an option if everything else fails.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Works good with PayPal’ is closed to new replies.