Payment Methods API

Save a payment method token

POST
https://api.sandbox.primer.io/payment-instruments/:paymentMethodToken/vault

Save a SINGLE_USE payment method token so it can be used again later. You can optionally choose to verify the payment method before vaulting. If verification fails, no payment method data will be vaulted. Verification can minimise fraud and boost subscription rates for recurring payments.

If you try to vault an already vaulted token, you will get the existing vaulted token back.

Path parameters

paymentMethodToken
string

Payment method token to store.

Request

This endpoint expects an object.
customerId
string

The ID representing the customer

verify
optional boolean

Whether the payment method should be verified before vaulting or not

Response

This endpoint return an object.
analyticsId
optional string

Unique analytics identifier corresponding to a payment method

createdAt
optional datetime

Creation date & time of the object (UTC)

customerId
optional string

The ID representing the customer

default
optional boolean

Whether or not this payment method is the default

deleted
optional boolean

Whether or not this object has been revoked.

deletedAt
optional datetime

Date & time when this object was revoked. (UTC)

description
optional string

A friendly description given by the user

isVerified
optional boolean

Whether or not this payment method was verified

paymentMethodData
optional union

Payment method data

paymentMethodType
optional enum

Payment method type associated with a token.

token
optional string

The vaulted payment method token.

tokenType
optional string
  • MULTI_USE a vaulted token that can be re-used with subsequent payments

Errors

POST
/payment-instruments/:paymentMethodToken/vault
1
2
3
4
5
6
curl -X POST "https://api.sandbox.primer.io/payment-instruments/:paymentMethodToken/vault" \
     -H "X-API-KEY: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "customerId": "string"
}'
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  "isVerified": true,
  "createdAt": "2023-01-01T00:00:00Z",
  "deletedAt": "2023-01-01T00:00:00Z",
  "deleted": true,
  "token": "string",
  "tokenType": "string",
  "analyticsId": "string",
  "paymentMethodType": "PAYMENT_CARD",
  "paymentMethodData": {
    "first6Digits": "string",
    "last4Digits": "string",
    "expirationMonth": "string",
    "expirationYear": "string",
    "cardholderName": "string",
    "network": "string",
    "isNetworkTokenized": true,
    "binData": {
      "network": "AMEX",
      "issuerCountryCode": "AW",
      "issuerName": "string",
      "issuerCurrencyCode": "AED",
      "regionalRestriction": "DOMESTIC_USE_ONLY",
      "accountNumberType": "PRIMARY_ACCOUNT_NUMBER",
      "accountFundingType": "CREDIT",
      "prepaidReloadableIndicator": "RELOADABLE",
      "productUsageType": "CONSUMER",
      "productCode": "string",
      "productName": "string"
    }
  },
  "customerId": "string",
  "description": "string",
  "default": true
}