Add to checkout
Integrate iDEAL payments using Pay.com.js or the REST API.
You can accept iDEAL payments in three ways:
- Universal checkout: Pay.com.js displays iDEAL in its payment form.
- Headless checkout: You build your own checkout UI, and Pay.com.js starts the iDEAL payment when the customer selects it.
- Server-to-server: You create the charge from your server and redirect the customer to iDEAL.
Before you start, ask your account manager to enable iDEAL for your account, then turn it on in the Pay.com dashboard.
Universal checkout
Universal checkout displays iDEAL in its payment form when the payment session includes it.
- 1
Create a payment session
On your server, create a payment session with
POST /v1/sessions/paymentand include"ideal"inpayment_method_types.{ "amount": 8000, "currency": "eur", "customer_reference_id": "cust-001", "payment_method_types": ["card", "ideal"] }Amounts are in the currency's minor unit, so
8000is €80.00.customer_reference_idis your own ID for the customer, and it's required. Return the session'sclient_secretto your page. - 2
Display the checkout
On your page, initialize Pay.com.js with the
client_secretand mount Universal checkout, as in Universal checkout.iDEAL appears only in Universal checkout's radio layout, so set
alternativesto'radio'. When the customer selects iDEAL, the form also displays iDEAL Bank.checkout.universal({ container: '#pay-com-checkout', alternatives: 'radio', }) - 3
Handle the result
When the customer selects iDEAL and clicks Pay, Pay.com.js opens iDEAL in a window over your page. If the customer closes the window, Pay.com.js calls
onFailure.When the customer finishes, Pay.com.js calls
onSuccessif the payment succeeded,onPendingif its result isn't final yet, oronFailureif it failed. Fulfill the order when you receive thecharge.succeededwebhook event.
Headless checkout
With Headless checkout, you build your own checkout UI, and Pay.com.js starts the iDEAL payment when the customer selects it.
- 1
Create a payment session
Create the payment session on your server as in Universal checkout, with
"ideal"inpayment_method_types, and initialize Pay.com.js with itsclient_secret. - 2
Check that iDEAL is available
Call
checkout.getPaymentMethods(), and show your iDEAL button only when the list includes it. Don't usecheckout.canMakePayments()for this, because it reports only Apple Pay and Google Pay.const methods = await checkout.getPaymentMethods() const ideal = methods.find((method) => method.paymentMethodType === 'ideal') - 3
Collect required customer fields
iDEAL's entry has a
fieldsarray. Render an input for each field, and use each field'sidas its key when you start the payment.Field Checkout label Required Format biciDEAL Bank Yes One of 14 options - 4
Start the payment
When the customer selects iDEAL, call
checkout.headless()with'ideal'and the collected field values.try { await checkout.headless('ideal', { bic: 'INGBNL2A' }) } catch (error) { // onFailure receives the error details too. }Pay.com.js opens iDEAL in a window over your page. If the customer closes the window, Pay.com.js calls
onFailure.When the customer finishes, Pay.com.js calls
onSuccessif the payment succeeded,onPendingif its result isn't final yet, oronFailureif it failed. Fulfill the order when you receive thecharge.succeededwebhook event.
Server-to-server
From your server, an iDEAL payment takes four steps: collect the customer's choice, create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to iDEAL.
- 1
Collect the customer's choice
The API has no call that lists iDEAL's choices, so build your own selector and send the selected value in
source_data.ideal.bic. The table lists the values Pay.com's checkout offers today. The list changes as iDEAL changes, and with Headless checkout,checkout.getPaymentMethods()returns the current one.iDEAL Bank Value Rabobank RABONL2UABN Amro ABNANL2AVan Lanschot FVLBNL22Triodos Bank TRIONL2UING Bank INGBNL2ASNS Bank SNSBNL2AASN Bank ASNBNL21RegioBank RBRBNL21Knab KNABNL2Hbunq B.V BUNQNL2ARevolut REVOLT21Yoursafe BITSNL2AN26 NTSBDEB1Nationale-Nederlanden Bank NNBANL2G - 2
Create the charge
Send
POST /v1/chargeswithsource_data.typeset to"ideal".source_data.idealcontains iDEAL-specific fields. Pay.com passessource_data.billing_detailsto iDEAL to prefill its page for the customer.{ "amount": 8000, "currency": "eur", "source_data": { "type": "ideal", "ideal": { "bic": "INGBNL2A" }, "billing_details": { "name": "Jan de Vries", "address": { "country": "NL" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" }{ "id": "chrg_702172227948251136", "resource": "charge", "amount": 8000, "currency": "eur", "status": "requires_authentication", "payment_method_details": { "type": "ideal" }, "reference": "order-12345", "test_mode": true }The charge's
statusisrequires_authenticationuntil the customer approves the payment. - 3
Create a linked authentication session
Send
POST /v1/sessions/authentication/linkedwith the charge'sidasresourceand thereturn_urlto return the customer to.confirmdefaults totrue, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session.{ "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" }{ "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } - 4
Redirect the customer
Send the customer to the session's
urlwith a full-page redirect. After they approve or cancel the payment, iDEAL redirects them back to yourreturn_url. Fulfill the order when you receive thecharge.succeededwebhook event, and handlecharge.failedas a canceled, declined, or abandoned payment.If the customer doesn't finish, the charge stays
requires_authenticationuntil the authentication session expires (60 minutes by default). It then moves tofailed, and thecharge.failedevent fires.
Testing
Test against https://api.sandbox.pay.com/v1 with your sk-pay-com-sandbox- API
key. Test transactions never move real funds. See
Environments.
iDEAL must be enabled on your sandbox account before you can test. Contact your account manager if it isn't enabled yet.
Test BIC for server-to-server testing
In the live environment, you pass the real BIC of the customer's bank
(for example, INGBNL2A for ING). In the sandbox, use the test BIC
TESTNL2A. This is not a real bank. It routes to the iDEAL | Wero
test simulator, which lets you choose the payment outcome (success,
failure, cancellation, and so on) without interacting with a real
bank.
Use TESTNL2A in source_data.ideal.bic for all server-to-server
test charges:
"ideal": {
"bic": "TESTNL2A"
}The test BIC also works with Headless checkout. Pass it as
checkout.headless('ideal', { bic: 'TESTNL2A' }).
Sandbox behavior
In the sandbox with the TESTNL2A BIC (Headless checkout or
server-to-server), Pay.com redirects to the iDEAL | Wero test
simulator. The simulator shows the iDEAL | Wero logo and asks
"Which test simulation to run?" with five options:
- Success: simulates a completed payment
- Cancellation: simulates the customer canceling after login
- Cancellation before login: simulates the customer canceling before authenticating with their bank
- Expiration: simulates the payment session expiring
- Failure: simulates a bank-side failure
After you select an outcome, the behavior depends on the scenario.
For Success, Cancellation, Cancellation before login,
and Failure, Pay.com shows an "Authorising your payment"
processing screen and then redirects the customer to your
return_url. For Expiration, the simulator shows "The
transaction is expired" with a Go back to iDEAL button and
redirects automatically after a countdown.
- SDK integration: Pay.com.js opens the test simulator in a window
over your page. After the simulation completes, Pay.com shows an
"Authorising your payment" screen, and the SDK fires
onSuccess,onPending, oronFailureon your page. - Server-to-server integration: the linked authentication
session returns a redirect
url. Opening this URL in a browser loads the test simulator as a full page.
Test scenarios
Run each simulation and check that your integration handles the resulting charge status and webhook event.
| Scenario | Test action | Expected result |
|---|---|---|
| Successful payment | Click Success | Charge moves to succeeded. charge.succeeded webhook fires. payment_method_details.type changes to eu_bank_account with source: "ideal". |
| Customer cancels | Click Cancellation | Charge moves to failed with failure_code: "customer_cancellation". charge.failed webhook fires. |
| Cancel before login | Click Cancellation before login | Charge moves to failed with failure_code: "customer_cancellation". charge.failed webhook fires. |
| Session expires | Click Expiration | The simulator shows "The transaction is expired" and redirects back. The charge stays in requires_authentication until the Pay.com authentication session expires, then moves to failed with failure_code: "time_out". The session's duration is 60 minutes by default. |
| Bank failure | Click Failure | Charge moves to failed with failure_code: "do_not_honour". charge.failed webhook fires. |
Verifying the charge after authentication
After the customer completes the test simulator and is redirected
to your return_url, retrieve the charge with
GET /v1/charges/{id}
to verify its final state:
curl -X GET "https://api.sandbox.pay.com/v1/charges/chrg_764827872052382720" \
-u ':sk-pay-com-sandbox-…'{
"id": "chrg_764827872052382720",
"resource": "charge",
"amount": 8000,
"amount_human_readable": "80.00",
"currency": "eur",
"status": "succeeded",
"payment_method": "pm_eu_bank_account_764830713110331392",
"payment_method_details": {
"type": "eu_bank_account",
"eu_bank_account": {
"account_holder_name": "Jan de Vries",
"country": "NL",
"currency": "EUR",
"last4": "9868",
"source": "ideal"
}
},
"test_mode": true
}After successful authentication, payment_method_details.type
changes from "ideal" to "eu_bank_account" and a
pm_eu_bank_account_... payment method ID is assigned. This is
expected. iDEAL is the payment flow, and eu_bank_account is the
resulting payment instrument.