Payment Intents
We are currently not accepting new customers on to this product
If you have access to test mode, please check with your
Duffel contact that you’re able to use the product in
live mode before starting your integration.
A payment intent is used to collect and capture a payment from a customer to top-up your balance and then pay for an offer, order, or order change offer. You're able to include markup here.
Schema
The ISO 3166-1 alpha-2 code of the country that issued the card used to confirm the payment intent.
It will be null
until the payment intent is confirmed.
"GB"
This value is used when displaying the payment collection form to securely identify and transmit the values to Duffel.
"eyJjbGllbnRfc2VjcmV0IjoicGlfMUl5YTBiQW5rMVRkeXJvRE1iWkJPN0ZSX3NlY3JldF9TbGFrYnJjYnFHZGZha2VrcjdCNE5jZWVyIiwicHVibGlzaGFibGVfa2V5IjoicGtfbGl2ZV81MUl0Q3YwQW5rMUdkeXJvRFlFU3M3RnBTUEdrNG9kbDhneDF3Y1RBNVEzaUcyWEFWVEhxdFlKSVhWMUxoSU5GQUtFMjA1dFdmRGVIcXhwUVdnYkIzTkVFbzAwMmdVY1hzR0YifQ=="
The ISO 8601 datetime at which the payment intent was confirmed.
It will be null
until the payment intent is confirmed.
"2020-04-11T15:49:02.642Z"
The ISO 8601 datetime at which the payment intent was created
"2020-04-11T15:48:11.642Z"
The currency of the amount
, as an
ISO 4217 currency code.
The card payment will be charged in this currency.
If it's different to your balance currency, it will be converted to your balance currency before the balance is topped up.
"GBP"
The currency of the fees_amount
, as an
ISO 4217 currency code.
This currency will match your balance currency.
It will be null
until the payment intent is confirmed.
"GBP"
The currency of the net_amount
, as an
ISO 4217 currency code.
This currency will match your balance currency.
It will be null
until the payment intent is confirmed.
"GBP"
The ISO 8601 datetime at which the payment intent was updated
"2020-04-11T15:48:11.642Z"
Create a Payment Intent
To begin the process of collecting a card payment from your customer, you need to create a payment intent.
The payment intent will contain a client_token
that you use to collect the
card payment in the frontend of your application. Read our
guide on how to do this.
If the payment intent is created in test mode you should use a test card.
Body parameters
This is the amount that the card payment being taken will be charged.
It should be enough to cover the service(s) you want to sell (enough to book an offer for example) and the processing fees.
If the currency is different from your Balance currency you should also account for foreign exchange.
It can be higher than that, in which case the remainder will be considered your markup.
If it's higher than the maximum allowed for you organisation you will get a validation error. By default the maximum is 5,000.00 GBP (or equivalent in the same currency). If you need a maximum higher than the default please get in touch with us via help@duffel.com.
"30.20"
The currency of the amount
, as an
ISO 4217 currency code.
This is going to be the currency that the card payment being taken in will be charged in.
"GBP"
POST https://api.duffel.com/payments/payment_intents
curl -X POST --compressed "https://api.duffel.com/payments/payment_intents" \-H "Accept-Encoding: gzip" \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Duffel-Version: v2" \-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \-d '{"data": {"currency": "GBP","amount": "30.20"}}'
{"data": {"updated_at": "2020-04-11T15:48:11.642Z","status": "requires_payment_method","refunds": [],"live_mode": true,"id": "pit_00009hthhsUZ8W4LxQgkjo","currency": "GBP","created_at": "2020-04-11T15:48:11.642Z","client_token": "eyJjbGllbnRfc2VjcmV0IjoicGlfMUl5YTBiQW5rMVRkeXJvRE1iWkJPN0ZSX3NlY3JldF9TbGFrYnJjYnFHZGZha2VrcjdCNE5jZWVyIiwicHVibGlzaGFibGVfa2V5IjoicGtfbGl2ZV81MUl0Q3YwQW5rMUdkeXJvRFlFU3M3RnBTUEdrNG9kbDhneDF3Y1RBNVEzaUcyWEFWVEhxdFlKSVhWMUxoSU5GQUtFMjA1dFdmRGVIcXhwUVdnYkIzTkVFbzAwMmdVY1hzR0YifQ==","amount": "300.10"}}
Confirm a Payment Intent
Once you've successfully collected the customer's card details, using the
client_token
from when you first created the Payment Intent, you then need to
confirm it using this endpoint.
Once confirmed, the amount charged to your customer's card will be added to your balance (minus any Duffel Payment fees). Attempting to confirm it more than once will have no effect.
POST https://api.duffel.com/payments/payment_intents/{id}/actions/confirm
curl -X POST --compressed "https://api.duffel.com/payments/payment_intents/{id}/actions/confirm" \-H "Accept-Encoding: gzip" \-H "Accept: application/json" \-H "Duffel-Version: v2" \-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
{"data": {"updated_at": "2020-04-11T15:48:11.642Z","status": "succeeded","refunds": [],"net_currency": "GBP","net_amount": "297.10","live_mode": true,"id": "pit_00009hthhsUZ8W4LxQgkjo","fees_currency": "GBP","fees_amount": "3.00","currency": "GBP","created_at": "2020-04-11T15:48:11.642Z","confirmed_at": "2020-04-11T15:49:02.642Z","client_token": "eyJjbGllbnRfc2VjcmV0IjoicGlfMUl5YTBiQW5rMVRkeXJvRE1iWkJPN0ZSX3NlY3JldF9TbGFrYnJjYnFHZGZha2VrcjdCNE5jZWVyIiwicHVibGlzaGFibGVfa2V5IjoicGtfbGl2ZV81MUl0Q3YwQW5rMUdkeXJvRFlFU3M3RnBTUEdrNG9kbDhneDF3Y1RBNVEzaUcyWEFWVEhxdFlKSVhWMUxoSU5GQUtFMjA1dFdmRGVIcXhwUVdnYkIzTkVFbzAwMmdVY1hzR0YifQ==","card_network": "visa","card_last_four_digits": "4242","card_country_code": "GB","amount": "300.10"}}
GET https://api.duffel.com/payments/payment_intents/{id}
curl -X GET --compressed "https://api.duffel.com/payments/payment_intents/{id}" \-H "Accept-Encoding: gzip" \-H "Accept: application/json" \-H "Duffel-Version: v2" \-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
{"data": {"updated_at": "2020-04-11T15:48:11.642Z","status": "succeeded","refunds": [{"updated_at": "2020-04-11T15:48:11.642Z","status": "succeeded","payment_intent_id": "pit_00009hthhsUZ8W4LxQgkjo","net_currency": "GBP","net_amount": "300.10","live_mode": true,"id": "ref_00009hthhsUZ8W4LxQgkjo","destination": "original_form_of_payment","currency": "GBP","created_at": "2020-04-11T15:48:11.642Z","arrival": "Credit approximately 5-10 business days later, depending upon the bank.","amount": "300.10"}],"net_currency": "GBP","net_amount": "297.10","live_mode": true,"id": "pit_00009hthhsUZ8W4LxQgkjo","fees_currency": "GBP","fees_amount": "3.00","currency": "GBP","created_at": "2020-04-11T15:48:11.642Z","confirmed_at": "2020-04-11T15:49:02.642Z","client_token": "eyJjbGllbnRfc2VjcmV0IjoicGlfMUl5YTBiQW5rMVRkeXJvRE1iWkJPN0ZSX3NlY3JldF9TbGFrYnJjYnFHZGZha2VrcjdCNE5jZWVyIiwicHVibGlzaGFibGVfa2V5IjoicGtfbGl2ZV81MUl0Q3YwQW5rMUdkeXJvRFlFU3M3RnBTUEdrNG9kbDhneDF3Y1RBNVEzaUcyWEFWVEhxdFlKSVhWMUxoSU5GQUtFMjA1dFdmRGVIcXhwUVdnYkIzTkVFbzAwMmdVY1hzR0YifQ==","card_network": "visa","card_last_four_digits": "4242","card_country_code": "GB","amount": "300.10"}}