Skip to content

Create gateway token

Request

Request to create a gateway token, which is used to represent sensitive payment data in a secure and tokenised form.

Path
ownerIdstring, [ 0 .. 20 ] charactersrequired

The identifier of the vault owner. This must match the owner type. For example, provide your merchant group ID when ownerType is MerchantGroup.

Example:MERCHANT-GROUP-1
ownerTypestringrequired

The type of entity that owns the token vault. Use with ownerId to identify which vault to use.

Enum:"Referrer""MerchantGroup""Merchant""Site"
Example:MerchantGroup
Bodyapplication/json
cardobjectrequired

Details about the card for tokenisation.

customerConsentobject

Optional details about the customer's consent to store their payment card. Include this when you create the token if you might need to revoke consent later.

curl -i -X POST \
  https://api-services.pxp.io/api/v1/token-vault/MerchantGroup/MERCHANT-GROUP-1/vaults/gateway-tokens \
  -H 'Content-Type: application/json' \
  -d '{
    "card": {
      "primaryAccountNumber": "4111111111111111",
      "expiryMonth": "03",
      "expiryYear": "2025",
      "holderName": "Mr John Doe",
      "cardVerificationCode": "123"
    },
    "customerConsent": {
      "hasCustomerConsent": true,
      "merchantId": "MERCHANT-001",
      "merchantShopperId": "6152"
    }
  }'

Responses

Successful creation of the gateway token

Bodyapplication/json
gatewayTokenIdstring, (uuid)

A securely stored token that corresponds to a previously saved payment card. This token is generated and maintained by PXP to facilitate recurring transactions or transactions using stored card details, ensuring enhanced security and convenience. When a transaction is performed with a saved card, this gateway token ID should be provided instead of the full card details. This approach enhances security by reducing the exposure of sensitive card information and simplifies the transaction process for returning customers.

Example:"7f46c09d-d1d1-4f94-9a88-6e8ac32e6341"
maskedPrimaryAccountNumberstring

The masked primary account number (PAN) of the card.

Example:"123456******7890"
fundingSourcestring or null

The funding source type of the card.

Enum:"Credit""Debit""Prepaid"
Example:"Credit"
Response
{ "gatewayTokenId": "7f46c09d-d1d1-4f94-9a88-6e8ac32e6341", "maskedPrimaryAccountNumber": "123456******7890", "fundingSource": "Credit" }