curl --request POST \
--url https://api.loyalty.dog/v2/giftcards/programs/{programId}/cards \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"initialValue": 5000.005,
"merchantId": "5eb7cf5a86d9755df3a6c593"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({initialValue: 5000.005, merchantId: '5eb7cf5a86d9755df3a6c593'})
};
fetch('https://api.loyalty.dog/v2/giftcards/programs/{programId}/cards', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.loyalty.dog/v2/giftcards/programs/{programId}/cards"
payload = {
"initialValue": 5000.005,
"merchantId": "5eb7cf5a86d9755df3a6c593"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "5eb7cf5a86d9755df3a6c593",
"cardNumber": "<string>",
"balance": "<string>",
"initialValue": "<string>",
"status": "pending",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"activatedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"suspendedReason": "<string>",
"suspendedUntil": "2023-11-07T05:31:56Z",
"suspendedAt": "2023-11-07T05:31:56Z",
"customerId": "5eb7cf5a86d9755df3a6c593",
"customerEmail": "<string>",
"customerPhone": "<string>",
"customerName": "<string>",
"merchantId": "5eb7cf5a86d9755df3a6c593",
"isPhysical": true,
"designTemplate": "<string>",
"customMessage": "<string>",
"lastFourDigits": "<string>",
"programId": "5eb7cf5a86d9755df3a6c593",
"card": {
"serialNumber": "<string>",
"passTypeIdentifier": "<string>",
"url": "<string>"
},
"senderName": "<string>",
"merchantName": "<string>",
"deliverAt": "2023-11-07T05:31:56Z",
"delivered": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Creategiftcard
Create a new gift card in pending status with a generated card number and security code.
Validates and sets the expiration (defaults to 1 year, must not exceed 5 years), sanitizes the provided custom message to prevent XSS, generates a unique 16-digit card number and a 6-digit security code, persists the card with a zero balance and the requested initialValue, and returns the persisted card representation.
Parameters: data (CreateGiftCardRequest): Request payload containing initialValue, merchantId, optional customer fields, expiration, isPhysical, designTemplate, and customMessage.
Returns: GiftCardResponse: The newly created gift card data (status will be “pending”); the security code is stored but not returned.
curl --request POST \
--url https://api.loyalty.dog/v2/giftcards/programs/{programId}/cards \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"initialValue": 5000.005,
"merchantId": "5eb7cf5a86d9755df3a6c593"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({initialValue: 5000.005, merchantId: '5eb7cf5a86d9755df3a6c593'})
};
fetch('https://api.loyalty.dog/v2/giftcards/programs/{programId}/cards', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.loyalty.dog/v2/giftcards/programs/{programId}/cards"
payload = {
"initialValue": 5000.005,
"merchantId": "5eb7cf5a86d9755df3a6c593"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "5eb7cf5a86d9755df3a6c593",
"cardNumber": "<string>",
"balance": "<string>",
"initialValue": "<string>",
"status": "pending",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"activatedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"suspendedReason": "<string>",
"suspendedUntil": "2023-11-07T05:31:56Z",
"suspendedAt": "2023-11-07T05:31:56Z",
"customerId": "5eb7cf5a86d9755df3a6c593",
"customerEmail": "<string>",
"customerPhone": "<string>",
"customerName": "<string>",
"merchantId": "5eb7cf5a86d9755df3a6c593",
"isPhysical": true,
"designTemplate": "<string>",
"customMessage": "<string>",
"lastFourDigits": "<string>",
"programId": "5eb7cf5a86d9755df3a6c593",
"card": {
"serialNumber": "<string>",
"passTypeIdentifier": "<string>",
"url": "<string>"
},
"senderName": "<string>",
"merchantName": "<string>",
"deliverAt": "2023-11-07T05:31:56Z",
"delivered": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
JWT access token obtained from POST /v2/token.
Path Parameters
24^[0-9a-f]{24}$"5eb7cf5a86d9755df3a6c593"
Query Parameters
24^[0-9a-f]{24}$"5eb7cf5a86d9755df3a6c593"
Body
0.01 <= x <= 1000024^[0-9a-f]{24}$"5eb7cf5a86d9755df3a6c593"
255255100500Response
Successful Response
24^[0-9a-f]{24}$"5eb7cf5a86d9755df3a6c593"
Gift card status enumeration.
pending, active, suspended, expired, voided, depleted 24^[0-9a-f]{24}$"5eb7cf5a86d9755df3a6c593"
24^[0-9a-f]{24}$"5eb7cf5a86d9755df3a6c593"
24^[0-9a-f]{24}$"5eb7cf5a86d9755df3a6c593"
The customer card object
Attributes: serialNumber (str): The serial number of the customer pass passTypeIdentifier (str): The pass type identifier of the customer pass url (str): The shareable URL of the customer pass
Show child attributes
Show child attributes
