Developer Guides
  • Introduction
    • Welcome
  • Core
    • Overview
    • Frontend
      • Implementation & Testing
      • Using the API endpoints
      • Gift cards
        • Gift Card validation API (Optional)
      • Check stock
      • Sibling products
      • Rewards program
      • Customer signatures
      • Retail transactions
      • Shopify Local Pick-up
  • API
    • Overview
    • Quick Start
    • Accounts
    • Changelog
    • Reference
      • Customers
      • Inventory
      • Orders
      • Products
      • Rewards
      • Stores
      • Vouchers
      • Staff
Powered by GitBook
On this page
  • Use the Gift Card validation API
  • Use the new SKU structure
  • Update the custom line item attributes
  • Gift Card validation API
  • Check Gift Card balance API

Was this helpful?

Export as PDF
  1. Core
  2. Frontend
  3. Gift cards

Gift Card validation API (Optional)

Use the Gift Card validation API

If there is a need to redeem the gift card outside the checkout page, specifically on the cart page, DotApparel offers a Gift Card validating API to address this scenario. The API endpoint employs the GET method and accepts query parameters such as the voucher number, PIN, and amount. Upon verifying the validity of the voucher number and PIN, the API will respond with a Shopify gift card code as part of the payload. Furthermore, the API will provide information about the available amount and other relevant details pertaining to the voucher. In this approach, the frontend can utilise the gift card code to include the gift card during the checkout process. For more comprehensive information, please refer to the section on the Gift Card validation API below.

Use the new SKU structure

Each denomination of the gift card and gift card type (physical or digital) should be defined as a separate variant of the Shopify product. The SKU structure should define the type and denomination so you might have AP21GIFTCARD-2124-0-1, AP21GIFTCARD-2124-0-2, AP21GIFTCARD-2124-0-3, AP21GIFTCARD-2124-0-4. The frontend template should allow the customer to select a gift card type (physical/digital) and then a denomination, which should select the appropriate variant.

Update the custom line item attributes

The custom line item attributes must have the following names.

  • From - This is the name of the sender.

  • To - This is the name of the receiver.

  • Email - This is the email of the receiver, for digital vouchers.

  • Message - Personal message, included in the email.

  • Email Subject (Optional) - This will override the email subject of the voucher.

Please note: Make sure all key names above are capitalised as they are case-sensitive within DotApparel.

Gift Card validation API

GET https://{shopDomain}/apps/dotapparel21/api-giftcardValidation?

// Query parameters
number   // voucher number e.g. 2062389
pin      // PIN number e.g. 7452
amount   // validation amount e.g. 100

// Response
{
    "data": {
        "voucher_number": "2062389",
        "expiry_date": "2026-07-07",
        "original_amount": "150.00",
        "original_amount_int": 15000,
        "used_amount": "0.00",
        "used_amount_int": 0,
        "available_amount": "150.00",
        "available_amount_int": 15000,
        "validated_amount": "100.00",
        "validated_amount_int": 10000,
        "shopify_code": "16892131261792389",
        "shopify_expires_at": null
    }
}

Check Gift Card balance API

POST https://{shopDomain}/apps/dotapparel21/api-checkGiftcardBalance

{
    "number": "4213925",
    "pin": "30411"
}

// Response
{
  status: "success",
  data: {
    voucherNumber: "4213925",
    expiryDate: "2023-12-01",
    originalAmount: "100",
    usedAmount: "0",
    availableAmount: "100",
  },
}

PreviousGift cardsNextCheck stock

Last updated 1 year ago

Was this helpful?