Tokenizing a Gift Card

To tokenize a gift card for a gift card program supported by your site, you can make use of our tokenize gift card API's. Unlike our scheme card tokenization service which necessitates the use of our PCI compliant Frames SDK , for gift cards you can host your own frames to capture the gift card number and pin.

High-level flow


How it works

  1. Create and host frames on your site allowing your customers to capture a gift card number and pin for a supported gift card program
  2. Your customer's gift card information is processed by us and we return a payment token which is a unique representation of the gift card without any sensitive information.
  3. The payment token can be used in our payments services to make a payment

Tokenizing a Gift Card

This method should be used to tokenize gift cards. The same API can be used for registered and guest customers.

curl --location --request POST 'https://{{environment}}' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: {{yourApiKey}}' \
--header 'Authorization: Bearer {{yourBearerToken}}' \
--data-raw '{
    "data": {
        "paymentInstrumentType": "GIFTCARD",
        "payload": {
            "cardNumber": "628000*************",
            "pinCode": "****",
            "primary": false,
            "save": true
    "meta": {}
var myHeaders = new Headers();
var environment = "substitute environment-value here"
var yourAPIkey = "YOUR-API-KEY";
var accessToken = "ACCESS-TOKEN";
myHeaders.append("Content-Type", "application/json");
myHeaders.append("X-Api-Key", yourAPIkey);
myHeaders.append("Authorization", `Bearer ${accessToken}`);

var raw = JSON.stringify({
  "data": {
        "paymentInstrumentType": "GIFTCARD",
        "payload": {
            "cardNumber": "628000*************",
            "pinCode": "****",
            "primary": false,
            "save": true
    "meta": {}

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'

fetch(`https://${environment}`, requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking

var semaphore = DispatchSemaphore (value: 0)

let yourAPIkey = "YOUR-API-KEY";
let environment = "substitute environment-value here"
let accessToken = "ACCESS-TOKEN";
let parameters = """
	\"data\": {\
		\"paymentInstrumentType\": \"GIFTCARD\",\
		\"payload\": {\
				\"cardNumber\": \"628000*************\",\
				\"pinCode\": \"****\",\
				\"primary\": false,\
				\"save\": true\
	\"meta\": {}\
let postData = .utf8)

var request = URLRequest(
  url: URL(string: "https://\(environment)")!,
  timeoutInterval: Double.infinity
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue(yourAPIkey, forHTTPHeaderField: "X-Api-Key")
request.addValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
  print(String(data: data, encoding: .utf8)!)

var environment = "substitute environment-value here"
var yourAPIkey = "YOUR-API-KEY"
var accessToken = "ACCESS-TOKEN"
val response =
  url = "https://$environment" + 
  headers = mapOf("Content-Type" to "application/json",
                  "X-Api-Key" to yourAPIkey,
                  "Authorization", "Bearer $accessToken"),
  json = mapOf("data" to mapOf (
                "paymentInstrumentType" to "APPLEPAY",
                "payload" to mapOf (
                     "cardNumber" to "628000*************",
                     "pinCode" to "****",
                     "primary" to false,
                     "save" to true
               "meta" to mapOf ()

if(response.statusCode == 200) {
  val obj : JSONObject = response.jsonObject
    println("Successful response payload: ${obj}")
} else {


  • cardNumber and pinCode are the values for the gift card your customer wishes to tokenize
  • primary can be set to true or false and this indicates whether it is a primary or secondary instrument when saving the card to the customer's wallet
  • save can be set to true or false and this indicates whether to save the card in the customer's wallet after tokenizing (multi-use token) or to only have a token be valid for a single transaction (single-use token)