Skip to main content

Create token

There are two ways of creating a card token, either in advance, without withdrawing any money, or during a purchase process.

Creating token in advance

To store a token without performing a payment, do the following:

Authentication

To authenticate, you create a Checkout API client and use the credentials to Create an access token. The same client can be used for Sandbox mode and production.

For all requests to the API set the following header:

Authorization: Bearer {access_token}

Create token session

With the access token, call Payment token session with this body:

{
"session": {
"order": {
"currency": "NOK",
"merchant_reference": "order-number"
},
"url": {
"return_url": "https://example.com/accept",
"callback_url": "https://example.com/callback?method=GET",
"merchant_terms_url": "https://example.com/terms.html"
},
"customer": {
"email": "john.doe@example.com",
"phone_number": "+4799999999"
}
},
"token_provider": {
"payment_product_type": "payex.creditcard",
"token_types": ["payment_token", "recurrence_token"]
}
}

The response will look like this:

{
"id": "T11223445.5cyWnV68vzJ1kYjZPrKWWm",
"url": "https://checkout.test.dintero.com/v1/view/T11223445.5cyWnV68vzJ1kYjZPrKWWm"
}

Redirect the customer to the url for them to confirm their card.

Creating token while performing a purchase

To store card information for a customer using Swedbank Pay during the payment process, do the following:

When creating the session set:

For payex.creditcard:

  • configuration.payex.creditcard.generate_payment_token=true
  • configuration.payex.creditcard.generate_recurrence_token=true

For bambora.creditcard:

  • configuration.bambora.creditcard.generate_payment_token=true

For dintero_psp.creditcard:

  • configuration.dintero_psp.creditcard.generate_payment_token=true

See create session for more information. It's also possible to disable CVC for returning payments if you have a dedicated agreement with Swedbank Pay.