Skip to main content

Use token

Customer initiated transactions

To use the token in a new session for the same customer, put the token value in the session under customer.tokens.payex.creditcard or customer.tokens.bambora.creditcard. See create session.

{
"url": {
"return_url": "https://example.com/thankyou",
"callback_url": "https://example.com/callback"
},
"order": {
"amount": 29990,
"currency": "NOK",
"merchant_reference": "merchants_order_number"
},
"customer": {
"email": "john.doe@example.com",
"phone_number": "+4799999999",
"tokens": {
"payex.creditcard": {
"payment_token": "<token previously acquired>"
}
}
},
"profile_id": "default"
}

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 the payment with CVC.

Recurrence transactions

To perform transactions without involving the customer, using a recurrence token, use recurring_purchase operation when calling the pay endpoint.

With the access token, call Create and pay merchant initiated session with the following body:

{
"session": {
"url": {
"callback_url": "https://example.com/callback?method=GET"
},
"customer": {
"email": "john.doe@example.com",
"phone_number": "+4799999999",
"tokens": {
"payex.creditcard": {
"recurrence_token": "<token previously acquired>"
}
}
},
"order": {
"amount": 29990,
"currency": "NOK",
"vat_amount": 6000,
"items": [
{
"line_id": "1",
"description": "Stablestol",
"quantity": 1,
"amount": 29990,
"vat_amount": 6000,
"vat": 25
}
],
"merchant_reference": "order-1"
},
"configuration": {
"auto_capture": false
}
},
"payment": {
"payment_product_type": "payex.creditcard",
"operation": "recurring_purchase"
}
}

Unscheduled transactions

To perform transactions without involving the customer, MIT (merchant initiated) transactions use unscheduled_purchase operation when calling the pay endpoint.

With the access token, call Create and pay merchant initiated session with the following body:

{
"session": {
"url": {
"callback_url": "https://example.com/callback?method=GET"
},
"customer": {
"email": "john.doe@example.com",
"phone_number": "+4799999999",
"tokens": {
"payex.creditcard": {
"payment_token": "<token previously acquired>"
}
}
},
"order": {
"amount": 29990,
"currency": "NOK",
"vat_amount": 6000,
"items": [
{
"line_id": "1",
"description": "Stablestol",
"quantity": 1,
"amount": 29990,
"vat_amount": 6000,
"vat": 25
}
],
"merchant_reference": "order-1"
},
"configuration": {
"auto_capture": false
}
},
"payment": {
"payment_product_type": "payex.creditcard",
"operation": "unscheduled_purchase"
}
}