gift_card_code

Description

Gift card codes are the individual resources that maintain balances, and that are entered by customers. The properties of a gift card code is inherited from the gift_card it belongs to.

In order to link a gift card code to a gift card code send a PATCH request with one of the following bodys:

{
    "customer_id": 54049
}
    
or
{
    "_links": {
        "customer_uri": "https://api.foxycart.test/customers/54049"
    }
}
    

If you would like to create multiple gift card codes at once, see the gift card documentation.

Interact with this resource

To interact with this resource and see it in the context of the API, you can utilise Postman or your Terminal/Console to perform requests. If you have a Foxy store, you can also use the API browser in the admin to interact with resources connected to your store.

Actions

GET
View a gift_card_code
PATCH
Update a gift_card_code (send only the properties you want to modify)
PUT
Replace a gift_card_code (send the entire representation)
DELETE
Delete a gift_card_code
HEAD
Get just the header response
OPTIONS
Get a response explaining which HTTP methods are supported

Properties

Property Description Type Constraints
code The string value of this gift card code which your customer will add to their cart to use this gift card. String Required. 50 characters or less.
current_balance Current balance on the gift card. Decimal Required
end_date The date when this gift card code will expire. Date Optional
date_created The date this resource was created.. Date Read only
date_modified The date this resource was last modified. Date Read only

Example Representation

{
    "_links": {
        "curies": [
            {
                "name": "fx",
                "href": "https://api.foxycart.com/rels/{rel}",
                "templated": true
            }
        ],
        "self": {
            "href": "https://api.foxycart.com/gift_card_codes/33",
            "title": "gf4"
        },
        "fx:store": {
            "href": "https://api.foxycart.com/stores/40075",
            "title": "This Store"
        },
        "fx:gift_card": {
            "href": "https://api.foxycart.com/gift_cards/6",
            "title": "This Gift Card"
        },
        "fx:gift_card_code_logs": {
            "href": "https://api.foxycart.com/gift_card_codes/33/logs",
            "title": "Transactions using this Gift Card Code"
        },
        "fx:provisioned_by_transaction_detail_id": {
            "href": "https://api.foxycart.com/transactions/5639772",
            "title": "This Transaction"
        }
    },
    "code": "37373-8LX2VW9D-JTSXQ",
    "current_balance": 12,
    "end_date": "2022-11-10T09:04:39-0800",
    "date_created": "2021-11-10T09:04:39-0800",
    "date_modified": "2021-11-10T09:04:39-0800"
}
<?xml version="1.0" encoding="UTF-8"?>
<resource href="https://api.foxycart.com/gift_card_codes/33" rel="https://api.foxycart.com/rels/gift_card_code">
  <link rel="self" href="https://api.foxycart.com/gift_card_codes/33" title="gf4"/>
  <link rel="https://api.foxycart.com/rels/store" href="https://api.foxycart.com/stores/40075" title="This Store"/>
  <link rel="https://api.foxycart.com/rels/gift_card" href="https://api.foxycart.com/gift_cards/6" title="This Gift Card"/>
  <link rel="https://api.foxycart.com/rels/gift_card_code_logs" href="https://api.foxycart.com/gift_card_codes/33/logs" title="Transactions using this Gift Card Code"/>
  <code>gf4</code>
  <current_balance>0</current_balance>
  <end_date></end_date>
  <date_created>2021-11-10T09: 04: 39-0800</date_created>
  <date_modified>2021-11-10T09: 04: 39-0800</date_modified>
</resource>
{
    "class": [
        "gift_card_code"
    ],
    "properties": {
        "code": "gf4",
        "current_balance": 0,
        "end_date": null,
        "date_created": "2021-11-10T09:04:39-0800",
        "date_modified": "2021-11-10T09:04:39-0800"
    },
    "links": [
        {
            "rel": [
                "self"
            ],
            "href": "https://api.foxycart.com/gift_card_codes/33"
        },
        {
            "rel": [
                "https://api.foxycart.com/rels/store"
            ],
            "href": "https://api.foxycart.com/stores/40075"
        },
        {
            "rel": [
                "https://api.foxycart.com/rels/gift_card"
            ],
            "href": "https://api.foxycart.com/gift_cards/6"
        },
        {
            "rel": [
                "https://api.foxycart.com/rels/gift_card_code_logs"
            ],
            "href": "https://api.foxycart.com/gift_card_codes/33/logs"
        }
    ],
    "actions": [
        {
            "name": "self",
            "title": "Update Gift Card Code",
            "method": "PATCH",
            "href": "https://api.foxycart.com/gift_card_codes/33",
            "type": "application/x-www-form-urlencoded",
            "fields": [
                {
                    "name": "code",
                    "title": "Code",
                    "type": "text",
                    "value": "gf4"
                },
                {
                    "name": "current_balance",
                    "title": "Current Balance",
                    "type": "text",
                    "value": 0
                },
                {
                    "name": "end_date",
                    "title": "End Date",
                    "type": "datetime",
                    "value": null
                }
            ]
        }
    ]
}

Zoomable Resources

This resource has no linked resources which can be "zoomed" in on, filtered and embedded within this resource.