I am wondering how to implement payments in Flutter(or any other framework, like react or angular). There is an existing website built in Wordpress and WooCommerce. The following plugin is used:
- WooCommerce
- Mollie payments for woocommerce (https://nl.wordpress.org/plugins/mollie-payments-for-woocommerce/)
How can I handle a payment, that matches the order id and moves the user to the payment banking screen?
When a user presses the "Checkout" button in the frontend, do I need to do the following?
- Call a custom function that was made in Wordpress PHP (wp-json/payment/create)
- Call the woocommerce endpoint create order in that PHP function. https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order.
- And then call the mollie endpoint create payment in that PHP function? https://docs.mollie.com/reference/v2/payments-api/create-payment. Put order id in parameters that I received from the woocommerce endpoint.
- Then return the redirect link to the react or flutter app
- How can I know that the payment is succesful? Then I can call 'update order' and set the status from 'waiting for payment' to 'processing order'. (So Wordpress admin can see that the customer paid.
I could not find a tutorial on this topic and therefore I decided to make this question public. I only saw wordpress tutorials... So I hope this question can help a lot of people.