Skip to content

Gift Cards API

Manage and validate gift cards in your store.

List Gift Cards

http
GET /api/external/v1/gift-cards

Query Parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 15, max: 100)
statusstringFilter: active, depleted, revoked
searchstringSearch by gift card code
emailstringFilter by recipient email

Example Request

bash
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/gift-cards?status=active" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "code": "ABCD-EFGH-IJKL-MNOP",
      "initial_balance": "50.00",
      "balance": "35.50",
      "currency": "USD",
      "status": "active",
      "recipient_email": "customer@example.com",
      "recipient_name": "John Doe",
      "personal_message": "Happy Birthday!",
      "product": {
        "id": 10,
        "name": "$50 Gift Card"
      },
      "order": {
        "id": 42,
        "order_number": "ORD-2025-042"
      },
      "purchased_at": "2025-01-15T10:30:00Z",
      "first_used_at": "2025-01-20T14:15:00Z",
      "last_used_at": "2025-01-25T09:45:00Z",
      "expires_at": "2026-01-15T23:59:59Z",
      "created_at": "2025-01-15T10:30:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 3,
    "per_page": 15,
    "total": 42
  }
}

Get Single Gift Card

http
GET /api/external/v1/gift-cards/{id}

Example Request

bash
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/gift-cards/1" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": {
    "id": 1,
    "code": "ABCD-EFGH-IJKL-MNOP",
    "initial_balance": "50.00",
    "balance": "35.50",
    "currency": "USD",
    "status": "active",
    "recipient_email": "customer@example.com",
    "recipient_name": "John Doe",
    "personal_message": "Happy Birthday!",
    "product": {
      "id": 10,
      "name": "$50 Gift Card"
    },
    "order": {
      "id": 42,
      "order_number": "ORD-2025-042"
    },
    "redemptions": [
      {
        "id": 1,
        "amount": "14.50",
        "balance_before": "50.00",
        "balance_after": "35.50",
        "order": {
          "id": 55,
          "order_number": "ORD-2025-055"
        },
        "created_at": "2025-01-20T14:15:00Z"
      }
    ],
    "purchased_at": "2025-01-15T10:30:00Z",
    "first_used_at": "2025-01-20T14:15:00Z",
    "last_used_at": "2025-01-20T14:15:00Z",
    "expires_at": "2026-01-15T23:59:59Z",
    "created_at": "2025-01-15T10:30:00Z"
  }
}

Check Gift Card Balance

Validate a gift card code and check its remaining balance. This endpoint can be used during checkout to verify gift cards entered by customers.

http
POST /api/external/v1/gift-cards/validate

Request Body

ParameterTypeRequiredDescription
codestringYesGift card code (dashes optional)

Example Request

bash
curl -X POST "https://yourstore.pixlpay.net/api/external/v1/gift-cards/validate" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"code": "ABCD-EFGH-IJKL-MNOP"}'

Success Response

json
{
  "success": true,
  "data": {
    "valid": true,
    "gift_card": {
      "id": 1,
      "code": "XXXX-XXXX-XXXX-MNOP",
      "balance": "35.50",
      "formatted_balance": "$35.50",
      "currency": "USD",
      "expires_at": "2026-01-15T23:59:59Z"
    }
  }
}

Invalid Card Response

json
{
  "success": false,
  "data": {
    "valid": false,
    "message": "Gift card has no remaining balance"
  }
}

Code Format

Gift card codes can be entered with or without dashes. Both ABCDEFGHIJKLMNOP and ABCD-EFGH-IJKL-MNOP are accepted.

Redeem Gift Card

Apply a gift card balance to reduce an order total.

http
POST /api/external/v1/gift-cards/{id}/redeem

Request Body

ParameterTypeRequiredDescription
amountnumberYesAmount to redeem (max: remaining balance)
order_idintegerNoOrder to apply redemption to

Example Request

bash
curl -X POST "https://yourstore.pixlpay.net/api/external/v1/gift-cards/1/redeem" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"amount": 15.00, "order_id": 100}'

Response

json
{
  "success": true,
  "data": {
    "redemption": {
      "id": 5,
      "amount": "15.00",
      "balance_before": "35.50",
      "balance_after": "20.50",
      "order_id": 100,
      "created_at": "2025-01-25T16:30:00Z"
    },
    "gift_card": {
      "id": 1,
      "balance": "20.50",
      "status": "active"
    }
  },
  "message": "Gift card redeemed successfully"
}

Partial Redemption

If the requested amount exceeds the available balance, only the available balance will be redeemed. Check the amount in the response to confirm the actual redeemed amount.

Update Gift Card

Update recipient information or expiration date.

http
PUT /api/external/v1/gift-cards/{id}

Request Body

ParameterTypeRequiredDescription
recipient_emailstringNoRecipient email address
recipient_namestringNoRecipient name
expires_atstringNoExpiration date (YYYY-MM-DD)

Example Request

bash
curl -X PUT "https://yourstore.pixlpay.net/api/external/v1/gift-cards/1" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"recipient_email": "newemail@example.com", "recipient_name": "Jane Doe"}'

Response

json
{
  "success": true,
  "data": {
    "id": 1,
    "code": "ABCD-EFGH-IJKL-MNOP",
    "recipient_email": "newemail@example.com",
    "recipient_name": "Jane Doe",
    "balance": "35.50",
    "status": "active"
  },
  "message": "Gift card updated successfully"
}

Revoke Gift Card

Permanently deactivate a gift card. This action cannot be undone.

http
POST /api/external/v1/gift-cards/{id}/revoke

Example Request

bash
curl -X POST "https://yourstore.pixlpay.net/api/external/v1/gift-cards/1/revoke" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": {
    "id": 1,
    "code": "ABCD-EFGH-IJKL-MNOP",
    "status": "revoked",
    "balance": "35.50"
  },
  "message": "Gift card revoked successfully"
}

Irreversible Action

Revoking a gift card is permanent. The remaining balance cannot be recovered or transferred. Use this only for fraud prevention or at customer request.

Get Gift Card Statistics

Retrieve aggregate statistics for all gift cards in your store.

http
GET /api/external/v1/gift-cards/statistics

Example Request

bash
curl -X GET "https://yourstore.pixlpay.net/api/external/v1/gift-cards/statistics" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "data": {
    "total_issued": 150,
    "total_active": 85,
    "total_depleted": 52,
    "total_revoked": 13,
    "total_issued_value": "7500.00",
    "total_remaining_balance": "2450.00",
    "total_redeemed_value": "5050.00"
  }
}

Resend Gift Card Email

Resend the gift card email to the recipient.

http
POST /api/external/v1/gift-cards/{id}/resend-email

Example Request

bash
curl -X POST "https://yourstore.pixlpay.net/api/external/v1/gift-cards/1/resend-email" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

json
{
  "success": true,
  "message": "Gift card email sent successfully"
}

Gift Card Object

FieldTypeDescription
idintegerUnique identifier
codestringGift card code (format: XXXX-XXXX-XXXX-XXXX)
initial_balancestringOriginal balance when purchased
balancestringCurrent remaining balance
currencystringCurrency code (USD, EUR, GBP, etc.)
statusstringactive, depleted, or revoked
recipient_emailstringRecipient email address
recipient_namestringRecipient name
personal_messagestringOptional message from purchaser
productobjectProduct this gift card was purchased as
orderobjectOrder that created this gift card
redemptionsarrayHistory of redemptions
purchased_atstringISO 8601 timestamp of purchase
first_used_atstringISO 8601 timestamp of first use
last_used_atstringISO 8601 timestamp of last use
expires_atstringISO 8601 expiration timestamp (null = never)
created_atstringISO 8601 creation timestamp

Gift Card Redemption Object

FieldTypeDescription
idintegerUnique identifier
amountstringAmount redeemed
balance_beforestringBalance before redemption
balance_afterstringBalance after redemption
orderobjectOrder that used this redemption
created_atstringISO 8601 timestamp

Gift Card Statuses

StatusDescription
activeGift card is valid and has remaining balance
depletedGift card balance has been fully used
revokedGift card has been manually deactivated

Errors

StatusErrorDescription
400Bad RequestGift card already revoked or invalid operation
400No RecipientNo recipient email set for resend
401UnauthorizedInvalid or missing token
403ForbiddenToken lacks gift_cards:read or gift_cards:write scope
404Not FoundGift card not found or invalid code
422UnprocessableValidation failed (invalid amount, expired card)

Required Scopes

EndpointRequired Scope
List, Get, Validate, Statisticsgift_cards:read
Redeem, Update, Revoke, Resend Emailgift_cards:write

Built for game developers, by game developers.