Payments using our Vault
If you choose to process CITs and MITs using payment credentials stored in our Vault, you can use the vault_instrument_id in the payment request instead of card details.
For more information on storing payment credentials and obtaining a vault_instrument_id, see Vault.
Payment flow using vault instrument
When using a vault_instrument_id instead of card details, follow these steps:
-
Store the card details
You can store the card details in either of the following ways:
a. Directly in our Vault using the separate Vault API (Using our Vault API service)
b. As part of an initial CIT payment request. (When processing a payment)
-
Retrieve the vault instrument
After the payment credentials have been stored, you will receive the
vault_instrument_idthrough a Vault API response or webhook. Store this ID so it can be used for future payments. -
Use the vault isntrument in subsequent payments
Pass the
vault_instrument_idin the method object of your CIT or MIT payment request instead of providing card details.
Network token vault instruments
To pay with a network token vault instrument, set method.type to network_token and pass its vault_instrument_id.
"method": {
"type": "network_token",
"vault_instrument_id": "ins_67890"
}
Details on required fields and validation can be found in our Open API specification.
- Production
- Sandbox
POST https://api.paytently.io/payments
POST https://sandbox.api.paytently.io/payments
Request:
- MIT
- CIT
curl --location 'https://sandbox.api.paytently.io/payments'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer token_here'
--data-raw '{
"reference": "ord124",
"amount": 100,
"currency": "EUR",
"customer": {
"id": "customer123",
"first_name": "Joe",
"last_name": "Bloggs",
"birth_date": "2001-06-03",
"contact": {
"phone": {
"country_code": "44",
"number": "07700900123"
},
"email": "email@example.com"
}
},
"method": {
"type": "card",
"vault_instrument_id": "ins_12345"
},
"credential_on_file": {
"initiator": "merchant",
"intent": "installment",
"stage": "subsequent",
"initial_payment_ids": {
"paytently": "pay_12345"
}
},
"billing_address": {
"line_one": "80 Queens Road",
"city": "Manchester",
"postal_code": "M6Y 7TH",
"country": "GBR"
},
"device_ip_address": "123.123.123.123",
"metadata": {
"key": "value"
}
}'
curl --location 'https://sandbox.api.paytently.io/payments'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer token_here'
--data-raw '{
"reference": "ord124",
"amount": 100,
"currency": "EUR",
"customer": {
"id": "customer123",
"first_name": "Joe",
"last_name": "Bloggs",
"birth_date": "2001-06-03",
"contact": {
"phone": {
"country_code": "44",
"number": "07700900123"
},
"email": "email@example.com"
}
},
"method": {
"type": "card",
"vault_instrument_id": "ins_12345"
},
"credential_on_file": {
"initiator": "customer",
"intent": "unscheduled",
"stage": "subsequent",
"initial_payment_ids": {
"paytently": "pay_12345"
}
},
"billing_address": {
"line_one": "80 Queens Road",
"city": "Manchester",
"postal_code": "M6Y 7TH",
"country": "GBR"
},
"urls": {
"authorize": {
"success": "https://success.com",
"failure": "https://failure.com"
},
"webhook": "https://example.com/paytently/webhooks",
"merchant_website": "https://example.com"
},
"device_ip_address": "123.123.123.123",
"metadata": {
"key": "value"
}
}'
Response:
- 202
- 400
- 422
- 500
{
"id": "pay_12345",
"status": "pending",
"_links": {
"self": {
"href": "https://sandbox.api.paytently.io/payments/pay_12345",
"method": "GET"
},
"authorize": {
"href": "https://sandbox.payredirect.io/authorize/pay_12345",
"method": "GET"
}
}
}
{
"trace_id": "12345",
"errors": [
{
"property": "metadata",
"code": "malformed_request",
"reason": "",
"docs": "https://docs.paytently.io/api/reference"
}
]
}
{
"trace_id": "12345",
"errors": [
{
"property": "reference",
"code": "reference_invalid",
"reason": "reference must not be more than 64 characters",
"detail": "Invalid length: 70",
"docs": "https://docs.paytently.io/api/reference"
},
{
"property": "reference",
"code": "reference_invalid",
"reason": "reference must only contain letters, numbers and accepted special characters: _-",
"detail": "Invalid characters: @",
"docs": "https://docs.paytently.io/api/reference"
}
]
}
{
"title": "Server error",
"status": 500,
"trace_id": "12345"
}