Headless Checkout

To create a Mollie payment using the Sylius API, follow these steps:

1. Retrieve Payment Configuration from Sylius

Send a request to Sylius API:

GET /api/v2/shop/orders/{tokenValue}/payments/{paymentId}/configuration
  • tokenValue → the order token, stored in the sylius_order database table.

  • paymentId → the ID of the payment within the order.

Example response:

{
  "method": "ideal",
  "issuer": "ideal_ABNANL2A",
  "cardToken": null,
  "amount": {
    "value": "18.75",
    "currency": "EUR"
  },
  "customerId": null,
  "description": "000000157",
  "redirectUrl": "{redirect_url}",
  "webhookUrl": "{webhook_url}",
  "metadata": {
    "order_id": 170,
    "customer_id": 22,
    "molliePaymentMethods": "ideal",
    "cartToken": null,
    "saveCardInfo": null,
    "useSavedCards": null,
    "selected_issuer": "ideal_ABNANL2A",
    "methodType": "Payments API",
    "refund_token": "{token}"
  },
  "locale": "en_US"
}

This JSON payload contains all details required to create the payment on Mollie.

2. Create the Payment on Mollie

Using the response above as the request body, create a payment via the Mollie API:

POST https://api.mollie.com/v2/payments
  • Authorization: use a Bearer token in the header. The token is available in your Mollie Dashboard under API keys.

Example:

POST /v2/payments HTTP/1.1
Host: api.mollie.com
Authorization: Bearer {your_mollie_api_key}
Content-Type: application/json

{ ...payload from Sylius API response... }

3. Redirect Customer to Mollie Checkout

The Mollie API response will include a checkout field containing the hosted payment URL:

{
  "checkout": {
    "href": "https://www.mollie.com/checkout/test-mode?method=ideal&token=6.voklib",
    "type": "text/html"
  }
}

Redirect the customer to this URL to complete payment.

4. Complete the Payment

  • The customer finalizes the payment on Mollie’s checkout page.

  • Mollie will notify your Sylius store via the configured webhook URL about the payment status update.

Last updated

Was this helpful?