GiftCode

The GiftCode endpoint allows you to generate and retrieve a PDF containing the gift code for a specific order and line item, provided that gift codes are activated for your shop.

GET/api/gift-code/pdf

Get Gift Code PDF

This endpoint allows you to generate and download a PDF containing the gift code for a specific order and line item. You must provide a valid API token and ensure that gift codes are activated for your shop.

Required parameters

  • Name
    order-id
    Type
    string
    Description

    The ID of the order for which you want to generate the gift code PDF.

Optional parameters

  • Name
    line-item-id
    Type
    string
    Description

    The ID of the line item for which you want to generate the gift code PDF (if applicable).

Authorization

You must provide a valid API token in the Authorization header as a Bearer token.

Request

GET
/api/gift-code/pdf
curl "https://web.baback.co/api/gift-code/pdf?order-id={orderId}&line-item-id={lineItemId}" \
  -H "Authorization: Bearer {token}"

Error Response: Not Authorized

{
  "error": 403,
  "code": "not-authorized",
  "message": "Your API token is not reconized"
}

Error Response: Missing order-id

{
  "error": 400,
  "code": "missing-order-id",
  "message": "order-id parameter is required"
}

Error Response: Gift code not activated

{
  "error": 400,
  "code": "gift-code-not-activated",
  "message": "Gift codes are not activated for this shop"
}