-
Notifications
You must be signed in to change notification settings - Fork 53
REST Integration
To integrate the Mollie extension with a PWA using REST, we added 2 endpoints to the normal Magento 2 checkout flow.
This is a normal flow:
- Create cart
- Add products
- Set shipping information
- Place order
When using Mollie the order flow looks like this:
- Create cart
- Add products
- Set shipping information
- Create payment token
- Place order
- Start transaction
To create a payment token you should do a GET request to the applicable endpoint:
GET /V1/carts/mine/mollie/payment-token
GET /V1/guest-carts/:cartId/mollie/payment-token
This will return a random 32 character string:
TumUZulyLVk16boibN59euvSr1Quh6hR
Next, after placing the order, do a POST request to the endpoint with the payment token:
POST /V1/mollie/transaction/start
{
"token": "TumUZulyLVk16boibN59euvSr1Quh6hR"
}
The response will be the redirect URL. You should redirect your user to this URL:
https://www.mollie.com/payscreen/order/checkout/rhdz9w
This page will handle the payment and redirect your user back to your webshop. By default, the URL of the Magento installation is used, but in most cases, you'll want to provide a custom URL.
You can enter one under
Stores -> Configuration -> Sales -> Payment Methods -> Mollie -> General -> Use custom redirect url?
.
The Mollie Payments extension is developed by Magmodules.