Skip to Content
Docs

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. 1

    Create a payment session

    On your server, create a payment session with POST /v1/sessions/payment and include "ideal" in payment_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 8000 is €80.00. customer_reference_id is your own ID for the customer, and it's required. Return the session's client_secret to your page.

  2. 2

    Display the checkout

    On your page, initialize Pay.com.js with the client_secret and mount Universal checkout, as in Universal checkout.

    iDEAL appears only in Universal checkout's radio layout, so set alternatives to 'radio'. When the customer selects iDEAL, the form also displays iDEAL Bank.

    checkout.universal({
      container: '#pay-com-checkout',
      alternatives: 'radio',
    })
  3. 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 onSuccess if the payment succeeded, onPending if its result isn't final yet, or onFailure if it failed. Fulfill the order when you receive the charge.succeeded webhook 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. 1

    Create a payment session

    Create the payment session on your server as in Universal checkout, with "ideal" in payment_method_types, and initialize Pay.com.js with its client_secret.

  2. 2

    Check that iDEAL is available

    Call checkout.getPaymentMethods(), and show your iDEAL button only when the list includes it. Don't use checkout.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. 3

    Collect required customer fields

    iDEAL's entry has a fields array. Render an input for each field, and use each field's id as its key when you start the payment.

    FieldCheckout labelRequiredFormat
    biciDEAL BankYesOne of 14 options
  4. 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 onSuccess if the payment succeeded, onPending if its result isn't final yet, or onFailure if it failed. Fulfill the order when you receive the charge.succeeded webhook 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. 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 BankValue
    RabobankRABONL2U
    ABN AmroABNANL2A
    Van LanschotFVLBNL22
    Triodos BankTRIONL2U
    ING BankINGBNL2A
    SNS BankSNSBNL2A
    ASN BankASNBNL21
    RegioBankRBRBNL21
    KnabKNABNL2H
    bunq B.VBUNQNL2A
    RevolutREVOLT21
    YoursafeBITSNL2A
    N26NTSBDEB1
    Nationale-Nederlanden BankNNBANL2G
  2. 2

    Create the charge

    Send POST /v1/charges with source_data.type set to "ideal". source_data.ideal contains iDEAL-specific fields. Pay.com passes source_data.billing_details to 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"
    }

    The charge's status is requires_authentication until the customer approves the payment.

  3. 3

    Create a linked authentication session

    Send POST /v1/sessions/authentication/linked with the charge's id as resource and the return_url to return the customer to. confirm defaults to true, 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"
    }
  4. 4

    Redirect the customer

    Send the customer to the session's url with a full-page redirect. After they approve or cancel the payment, iDEAL redirects them back to your return_url. Fulfill the order when you receive the charge.succeeded webhook event, and handle charge.failed as a canceled, declined, or abandoned payment.

    If the customer doesn't finish, the charge stays requires_authentication until the authentication session expires (60 minutes by default). It then moves to failed, and the charge.failed event 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, or onFailure on 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.

ScenarioTest actionExpected result
Successful paymentClick SuccessCharge moves to succeeded. charge.succeeded webhook fires. payment_method_details.type changes to eu_bank_account with source: "ideal".
Customer cancelsClick CancellationCharge moves to failed with failure_code: "customer_cancellation". charge.failed webhook fires.
Cancel before loginClick Cancellation before loginCharge moves to failed with failure_code: "customer_cancellation". charge.failed webhook fires.
Session expiresClick ExpirationThe 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 failureClick FailureCharge moves to failed with failure_code: "do_not_honour". charge.failed webhook fires.

Expiration compared with other failure scenarios: Cancellation and Failure update the charge status to failed immediately. Expiration works differently. It simulates the bank-side session timing out, but the Pay.com authentication session remains open. The charge stays in requires_authentication until the Pay.com session itself expires, at which point it moves to failed. Don't treat requires_authentication as a final state. Always wait for a charge.succeeded or charge.failed webhook before updating your order status.

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-…'

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.

Was this page helpful?