Gift Card
Shopify Plus
The Gift Card resource is available for private apps installed on Shopify Plus stores. As of API version 2021-04, the Gift Card resource is also available for custom apps installed on Shopify Plus stores. App development partners can also request access to the Gift Card resource from the support page in the Partner Dashboard.
A gift card is an alternative payment method. Each gift card has a unique code that is entered during checkout. Its balance can be redeemed over multiple checkouts. Optionally, a gift card can assigned to a specific customer. Gift card codes cannot be retrieved after they're created—only the last four characters can be retrieved.
You can use the GiftCard resource to create, retrieve, and update gift cards for a store. After a gift card is created, only the expiry date, note, and template suffix can be updated.
Note
You can't delete gift cards, but you can disable them. You can't enable gift cards that were previously disabled.
What you can do with Gift Card
The Shopify API lets you do the following with the Gift Card resource. More detailed versions of these general actions may be available:
- GET /admin/api/2019-10/gift_cards.json Retrieves a list of gift cards
- GET /admin/api/2019-10/gift_cards/{gift_card_id}.json Retrieves a single gift card
- GET /admin/api/2019-10/gift_cards/count.json Retrieves a count of gift cards
- POST /admin/api/2019-10/gift_cards.json Creates a gift card
- PUT /admin/api/2019-10/gift_cards/{gift_card_id}.json Updates an existing gift card
- POST /admin/api/2019-10/gift_cards/{gift_card_id}/disable.json Disables a gift card
- GET /admin/api/2019-10/gift_cards/search.json?query=last_characters:mnop Searches for gift cards
Gift Card properties
api_client_id |
The ID of the app that issued the gift card, if it was issued by an app. |
balance |
The balance of the gift card. |
code |
The gift card code, which is a string of alphanumeric characters. For security reasons, this is available only upon creation of the gift card. (minimum: 8 characters, maximum: 20 characters) |
created_at |
The date and time (ISO 8601 format) when the gift card was created. |
currency |
The currency of the gift card. |
customer_id |
The ID of a customer who is associated with this gift card. |
disabled_at |
The date and time (ISO 8601 format) when the gift card was disabled. |
expires_on |
The date ( |
id |
The ID of the gift card. |
initial_value |
The initial value of the gift card when it was created. |
last_characters |
The last four characters of the gift card code. Because gift cards are alternative payment methods, the full code cannot be retrieved. |
line_item_id |
The ID of the line item that caused the creation of this gift card, if it was created by an order. |
note |
The text of an optional note that a merchant can attach to the gift card. Not visible to customers. |
order_id |
The ID of the order that caused the creation of this gift card, if it was created by an order. |
template_suffix |
The suffix of the Liquid template that's used to render the gift card online. For example, if the value is |
user_id |
The ID of the user that issued the gift card, if it was issued by a user. |
updated_at |
The date and time (ISO 8601 format) when the gift card was last modified. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
status
|
Retrieve gift cards with a given status. Valid values:
|
limit
|
The maximum number of results to show. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve a list of all gift cards
GET /admin/api/2019-10/gift_cards.json
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 283097216,
"balance": "0.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0y0y",
"order_id": null
},
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a list of all enabled gift cards
GET /admin/api/2019-10/gift_cards.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a single gift card
GET /admin/api/2019-10/gift_cards/48394658.json
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
status
|
Count gift cards with a given status. Valid values:
|
Retrieve a count of all gift cards
GET /admin/api/2019-10/gift_cards/count.json
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Retrieve a count of enabled gift cards
GET /admin/api/2019-10/gift_cards/count.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Create a gift card with a custom code
POST /admin/api/2019-10/gift_cards.json
{
"gift_card": {
"note": "This is a note",
"initial_value": 100.0,
"code": "ABCD EFGH IJKL MNOP",
"template_suffix": "gift_cards.birthday.liquid"
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936328,
"balance": "100.00",
"created_at": "2021-02-22T17:39:27-05:00",
"updated_at": "2021-02-22T17:39:27-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": "This is a note",
"expires_on": null,
"template_suffix": "gift_cards.birthday.liquid",
"last_characters": "mnop",
"order_id": null,
"code": "abcdefghijklmnop"
}
}
Create a gift card with an automatically generated code
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936329,
"balance": "25.00",
"created_at": "2021-02-22T17:39:33-05:00",
"updated_at": "2021-02-22T17:39:33-05:00",
"currency": "USD",
"initial_value": "25.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "928b",
"order_id": null,
"code": "bdb25c3aab82928b"
}
}
Updates an existing gift card.
The gift card's balance can't be changed via the API. You can change only the expiry date, note, and template suffix.
Update the note of a gift card
PUT /admin/api/2019-10/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"note": "Updating with a new note"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:40-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": "Updating with a new note",
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Update the expiry date of a gift card
PUT /admin/api/2019-10/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"expires_on": "2020-01-01"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:42-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-01-01",
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Disable a gift card
POST /admin/api/2019-10/gift_cards/48394658/disable.json
{
"gift_card": {
"id": 48394658
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:43-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": "2021-02-22T17:39:43-05:00",
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Searches for gift cards that match a supplied query. The following fields are indexed by search:
created_at
updated_at
disabled_at
balance
initial_value
amount_spent
email
last_characters
Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
order
|
The field and direction to order results by. (default:disabled_at DESC )
|
query
|
The text to search for. |
limit
|
The maximum number of results to retrieve. (default:50 , maximum: 250 )
|
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve all gift cards with the last characters "mnop"
GET /admin/api/2019-10/gift_cards/search.json?query=last_characters:mnop
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 1063936331,
"balance": "10.00",
"created_at": "2021-02-22T17:39:50-05:00",
"updated_at": "2021-02-22T17:39:50-05:00",
"currency": "USD",
"initial_value": "10.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "mnop",
"order_id": null
}
]
}
Shopify Plus
The Gift Card resource is available for private apps installed on Shopify Plus stores. As of API version 2021-04, the Gift Card resource is also available for custom apps installed on Shopify Plus stores. App development partners can also request access to the Gift Card resource from the support page in the Partner Dashboard.
A gift card is an alternative payment method. Each gift card has a unique code that is entered during checkout. Its balance can be redeemed over multiple checkouts. Optionally, a gift card can assigned to a specific customer. Gift card codes cannot be retrieved after they're created—only the last four characters can be retrieved.
You can use the GiftCard resource to create, retrieve, and update gift cards for a store. After a gift card is created, only the expiry date, note, and template suffix can be updated.
Note
You can't delete gift cards, but you can disable them. You can't enable gift cards that were previously disabled.
What you can do with Gift Card
The Shopify API lets you do the following with the Gift Card resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-01/gift_cards.json Retrieves a list of gift cards
- GET /admin/api/2020-01/gift_cards/{gift_card_id}.json Retrieves a single gift card
- GET /admin/api/2020-01/gift_cards/count.json Retrieves a count of gift cards
- POST /admin/api/2020-01/gift_cards.json Creates a gift card
- PUT /admin/api/2020-01/gift_cards/{gift_card_id}.json Updates an existing gift card
- POST /admin/api/2020-01/gift_cards/{gift_card_id}/disable.json Disables a gift card
- GET /admin/api/2020-01/gift_cards/search.json?query=last_characters:mnop Searches for gift cards
Gift Card properties
api_client_id |
The ID of the app that issued the gift card, if it was issued by an app. |
balance |
The balance of the gift card. |
code |
The gift card code, which is a string of alphanumeric characters. For security reasons, this is available only upon creation of the gift card. (minimum: 8 characters, maximum: 20 characters) |
created_at |
The date and time (ISO 8601 format) when the gift card was created. |
currency |
The currency of the gift card. |
customer_id |
The ID of a customer who is associated with this gift card. |
disabled_at |
The date and time (ISO 8601 format) when the gift card was disabled. |
expires_on |
The date ( |
id |
The ID of the gift card. |
initial_value |
The initial value of the gift card when it was created. |
last_characters |
The last four characters of the gift card code. Because gift cards are alternative payment methods, the full code cannot be retrieved. |
line_item_id |
The ID of the line item that caused the creation of this gift card, if it was created by an order. |
note |
The text of an optional note that a merchant can attach to the gift card. Not visible to customers. |
order_id |
The ID of the order that caused the creation of this gift card, if it was created by an order. |
template_suffix |
The suffix of the Liquid template that's used to render the gift card online. For example, if the value is |
user_id |
The ID of the user that issued the gift card, if it was issued by a user. |
updated_at |
The date and time (ISO 8601 format) when the gift card was last modified. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
status
|
Retrieve gift cards with a given status. Valid values:
|
limit
|
The maximum number of results to show. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve a list of all gift cards
GET /admin/api/2020-01/gift_cards.json
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 283097216,
"balance": "0.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0y0y",
"order_id": null
},
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a list of all enabled gift cards
GET /admin/api/2020-01/gift_cards.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a single gift card
GET /admin/api/2020-01/gift_cards/48394658.json
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
status
|
Count gift cards with a given status. Valid values:
|
Retrieve a count of all gift cards
GET /admin/api/2020-01/gift_cards/count.json
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Retrieve a count of enabled gift cards
GET /admin/api/2020-01/gift_cards/count.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Create a gift card with a custom code
POST /admin/api/2020-01/gift_cards.json
{
"gift_card": {
"note": "This is a note",
"initial_value": 100.0,
"code": "ABCD EFGH IJKL MNOP",
"template_suffix": "gift_cards.birthday.liquid"
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936328,
"balance": "100.00",
"created_at": "2021-02-22T17:39:27-05:00",
"updated_at": "2021-02-22T17:39:27-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": "This is a note",
"expires_on": null,
"template_suffix": "gift_cards.birthday.liquid",
"last_characters": "mnop",
"order_id": null,
"code": "abcdefghijklmnop"
}
}
Create a gift card with an automatically generated code
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936329,
"balance": "25.00",
"created_at": "2021-02-22T17:39:33-05:00",
"updated_at": "2021-02-22T17:39:33-05:00",
"currency": "USD",
"initial_value": "25.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "928b",
"order_id": null,
"code": "bdb25c3aab82928b"
}
}
Updates an existing gift card.
The gift card's balance can't be changed via the API. You can change only the expiry date, note, and template suffix.
Update the note of a gift card
PUT /admin/api/2020-01/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"note": "Updating with a new note"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:40-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": "Updating with a new note",
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Update the expiry date of a gift card
PUT /admin/api/2020-01/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"expires_on": "2020-01-01"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:42-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-01-01",
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Disable a gift card
POST /admin/api/2020-01/gift_cards/48394658/disable.json
{
"gift_card": {
"id": 48394658
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:43-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": "2021-02-22T17:39:43-05:00",
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Searches for gift cards that match a supplied query. The following fields are indexed by search:
created_at
updated_at
disabled_at
balance
initial_value
amount_spent
email
last_characters
Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
order
|
The field and direction to order results by. (default:disabled_at DESC )
|
query
|
The text to search for. |
limit
|
The maximum number of results to retrieve. (default:50 , maximum: 250 )
|
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve all gift cards with the last characters "mnop"
GET /admin/api/2020-01/gift_cards/search.json?query=last_characters:mnop
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 1063936331,
"balance": "10.00",
"created_at": "2021-02-22T17:39:50-05:00",
"updated_at": "2021-02-22T17:39:50-05:00",
"currency": "USD",
"initial_value": "10.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "mnop",
"order_id": null
}
]
}
Shopify Plus
The Gift Card resource is available for private apps installed on Shopify Plus stores. As of API version 2021-04, the Gift Card resource is also available for custom apps installed on Shopify Plus stores. App development partners can also request access to the Gift Card resource from the support page in the Partner Dashboard.
A gift card is an alternative payment method. Each gift card has a unique code that is entered during checkout. Its balance can be redeemed over multiple checkouts. Optionally, a gift card can assigned to a specific customer. Gift card codes cannot be retrieved after they're created—only the last four characters can be retrieved.
You can use the GiftCard resource to create, retrieve, and update gift cards for a store. After a gift card is created, only the expiry date, note, and template suffix can be updated.
Note
You can't delete gift cards, but you can disable them. You can't enable gift cards that were previously disabled.
What you can do with Gift Card
The Shopify API lets you do the following with the Gift Card resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-04/gift_cards.json Retrieves a list of gift cards
- GET /admin/api/2020-04/gift_cards/{gift_card_id}.json Retrieves a single gift card
- GET /admin/api/2020-04/gift_cards/count.json Retrieves a count of gift cards
- POST /admin/api/2020-04/gift_cards.json Creates a gift card
- PUT /admin/api/2020-04/gift_cards/{gift_card_id}.json Updates an existing gift card
- POST /admin/api/2020-04/gift_cards/{gift_card_id}/disable.json Disables a gift card
- GET /admin/api/2020-04/gift_cards/search.json?query=last_characters:mnop Searches for gift cards
Gift Card properties
api_client_id |
The ID of the app that issued the gift card, if it was issued by an app. |
balance |
The balance of the gift card. |
code |
The gift card code, which is a string of alphanumeric characters. For security reasons, this is available only upon creation of the gift card. (minimum: 8 characters, maximum: 20 characters) |
created_at |
The date and time (ISO 8601 format) when the gift card was created. |
currency |
The currency of the gift card. |
customer_id |
The ID of a customer who is associated with this gift card. |
disabled_at |
The date and time (ISO 8601 format) when the gift card was disabled. |
expires_on |
The date ( |
id |
The ID of the gift card. |
initial_value |
The initial value of the gift card when it was created. |
last_characters |
The last four characters of the gift card code. Because gift cards are alternative payment methods, the full code cannot be retrieved. |
line_item_id |
The ID of the line item that caused the creation of this gift card, if it was created by an order. |
note |
The text of an optional note that a merchant can attach to the gift card. Not visible to customers. |
order_id |
The ID of the order that caused the creation of this gift card, if it was created by an order. |
template_suffix |
The suffix of the Liquid template that's used to render the gift card online. For example, if the value is |
user_id |
The ID of the user that issued the gift card, if it was issued by a user. |
updated_at |
The date and time (ISO 8601 format) when the gift card was last modified. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
status
|
Retrieve gift cards with a given status. Valid values:
|
limit
|
The maximum number of results to show. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve a list of all gift cards
GET /admin/api/2020-04/gift_cards.json
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 283097216,
"balance": "0.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0y0y",
"order_id": null
},
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a list of all enabled gift cards
GET /admin/api/2020-04/gift_cards.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a single gift card
GET /admin/api/2020-04/gift_cards/48394658.json
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
status
|
Count gift cards with a given status. Valid values:
|
Retrieve a count of all gift cards
GET /admin/api/2020-04/gift_cards/count.json
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Retrieve a count of enabled gift cards
GET /admin/api/2020-04/gift_cards/count.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Create a gift card with a custom code
POST /admin/api/2020-04/gift_cards.json
{
"gift_card": {
"note": "This is a note",
"initial_value": 100.0,
"code": "ABCD EFGH IJKL MNOP",
"template_suffix": "gift_cards.birthday.liquid"
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936328,
"balance": "100.00",
"created_at": "2021-02-22T17:39:27-05:00",
"updated_at": "2021-02-22T17:39:27-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": "This is a note",
"expires_on": null,
"template_suffix": "gift_cards.birthday.liquid",
"last_characters": "mnop",
"order_id": null,
"code": "abcdefghijklmnop"
}
}
Create a gift card with an automatically generated code
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936329,
"balance": "25.00",
"created_at": "2021-02-22T17:39:33-05:00",
"updated_at": "2021-02-22T17:39:33-05:00",
"currency": "USD",
"initial_value": "25.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "928b",
"order_id": null,
"code": "bdb25c3aab82928b"
}
}
Updates an existing gift card.
The gift card's balance can't be changed via the API. You can change only the expiry date, note, and template suffix.
Update the note of a gift card
PUT /admin/api/2020-04/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"note": "Updating with a new note"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:40-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": "Updating with a new note",
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Update the expiry date of a gift card
PUT /admin/api/2020-04/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"expires_on": "2020-01-01"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:42-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-01-01",
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Disable a gift card
POST /admin/api/2020-04/gift_cards/48394658/disable.json
{
"gift_card": {
"id": 48394658
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:43-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": "2021-02-22T17:39:43-05:00",
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Searches for gift cards that match a supplied query. The following fields are indexed by search:
created_at
updated_at
disabled_at
balance
initial_value
amount_spent
email
last_characters
Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
order
|
The field and direction to order results by. (default:disabled_at DESC )
|
query
|
The text to search for. |
limit
|
The maximum number of results to retrieve. (default:50 , maximum: 250 )
|
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve all gift cards with the last characters "mnop"
GET /admin/api/2020-04/gift_cards/search.json?query=last_characters:mnop
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 1063936331,
"balance": "10.00",
"created_at": "2021-02-22T17:39:50-05:00",
"updated_at": "2021-02-22T17:39:50-05:00",
"currency": "USD",
"initial_value": "10.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "mnop",
"order_id": null
}
]
}
Shopify Plus
The Gift Card resource is available for private apps installed on Shopify Plus stores. As of API version 2021-04, the Gift Card resource is also available for custom apps installed on Shopify Plus stores. App development partners can also request access to the Gift Card resource from the support page in the Partner Dashboard.
A gift card is an alternative payment method. Each gift card has a unique code that is entered during checkout. Its balance can be redeemed over multiple checkouts. Optionally, a gift card can assigned to a specific customer. Gift card codes cannot be retrieved after they're created—only the last four characters can be retrieved.
You can use the GiftCard resource to create, retrieve, and update gift cards for a store. After a gift card is created, only the expiry date, note, and template suffix can be updated.
Note
You can't delete gift cards, but you can disable them. You can't enable gift cards that were previously disabled.
What you can do with Gift Card
The Shopify API lets you do the following with the Gift Card resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-07/gift_cards.json Retrieves a list of gift cards
- GET /admin/api/2020-07/gift_cards/{gift_card_id}.json Retrieves a single gift card
- GET /admin/api/2020-07/gift_cards/count.json Retrieves a count of gift cards
- POST /admin/api/2020-07/gift_cards.json Creates a gift card
- PUT /admin/api/2020-07/gift_cards/{gift_card_id}.json Updates an existing gift card
- POST /admin/api/2020-07/gift_cards/{gift_card_id}/disable.json Disables a gift card
- GET /admin/api/2020-07/gift_cards/search.json?query=last_characters:mnop Searches for gift cards
Gift Card properties
api_client_id |
The ID of the app that issued the gift card, if it was issued by an app. |
balance |
The balance of the gift card. |
code |
The gift card code, which is a string of alphanumeric characters. For security reasons, this is available only upon creation of the gift card. (minimum: 8 characters, maximum: 20 characters) |
created_at |
The date and time (ISO 8601 format) when the gift card was created. |
currency |
The currency of the gift card. |
customer_id |
The ID of a customer who is associated with this gift card. |
disabled_at |
The date and time (ISO 8601 format) when the gift card was disabled. |
expires_on |
The date ( |
id |
The ID of the gift card. |
initial_value |
The initial value of the gift card when it was created. |
last_characters |
The last four characters of the gift card code. Because gift cards are alternative payment methods, the full code cannot be retrieved. |
line_item_id |
The ID of the line item that caused the creation of this gift card, if it was created by an order. |
note |
The text of an optional note that a merchant can attach to the gift card. Not visible to customers. |
order_id |
The ID of the order that caused the creation of this gift card, if it was created by an order. |
template_suffix |
The suffix of the Liquid template that's used to render the gift card online. For example, if the value is |
user_id |
The ID of the user that issued the gift card, if it was issued by a user. |
updated_at |
The date and time (ISO 8601 format) when the gift card was last modified. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
status
|
Retrieve gift cards with a given status. Valid values:
|
limit
|
The maximum number of results to show. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve a list of all gift cards
GET /admin/api/2020-07/gift_cards.json
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 283097216,
"balance": "0.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0y0y",
"order_id": null
},
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a list of all enabled gift cards
GET /admin/api/2020-07/gift_cards.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a single gift card
GET /admin/api/2020-07/gift_cards/48394658.json
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
status
|
Count gift cards with a given status. Valid values:
|
Retrieve a count of all gift cards
GET /admin/api/2020-07/gift_cards/count.json
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Retrieve a count of enabled gift cards
GET /admin/api/2020-07/gift_cards/count.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Create a gift card with a custom code
POST /admin/api/2020-07/gift_cards.json
{
"gift_card": {
"note": "This is a note",
"initial_value": 100.0,
"code": "ABCD EFGH IJKL MNOP",
"template_suffix": "gift_cards.birthday.liquid"
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936328,
"balance": "100.00",
"created_at": "2021-02-22T17:39:27-05:00",
"updated_at": "2021-02-22T17:39:27-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": "This is a note",
"expires_on": null,
"template_suffix": "gift_cards.birthday.liquid",
"last_characters": "mnop",
"order_id": null,
"code": "abcdefghijklmnop"
}
}
Create a gift card with an automatically generated code
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936329,
"balance": "25.00",
"created_at": "2021-02-22T17:39:33-05:00",
"updated_at": "2021-02-22T17:39:33-05:00",
"currency": "USD",
"initial_value": "25.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "928b",
"order_id": null,
"code": "bdb25c3aab82928b"
}
}
Updates an existing gift card.
The gift card's balance can't be changed via the API. You can change only the expiry date, note, and template suffix.
Update the note of a gift card
PUT /admin/api/2020-07/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"note": "Updating with a new note"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:40-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": "Updating with a new note",
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Update the expiry date of a gift card
PUT /admin/api/2020-07/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"expires_on": "2020-01-01"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:42-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-01-01",
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Disable a gift card
POST /admin/api/2020-07/gift_cards/48394658/disable.json
{
"gift_card": {
"id": 48394658
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:43-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": "2021-02-22T17:39:43-05:00",
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Searches for gift cards that match a supplied query. The following fields are indexed by search:
created_at
updated_at
disabled_at
balance
initial_value
amount_spent
email
last_characters
Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
order
|
The field and direction to order results by. (default:disabled_at DESC )
|
query
|
The text to search for. |
limit
|
The maximum number of results to retrieve. (default:50 , maximum: 250 )
|
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve all gift cards with the last characters "mnop"
GET /admin/api/2020-07/gift_cards/search.json?query=last_characters:mnop
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 1063936331,
"balance": "10.00",
"created_at": "2021-02-22T17:39:50-05:00",
"updated_at": "2021-02-22T17:39:50-05:00",
"currency": "USD",
"initial_value": "10.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "mnop",
"order_id": null
}
]
}
Shopify Plus
The Gift Card resource is available for private apps installed on Shopify Plus stores. As of API version 2021-04, the Gift Card resource is also available for custom apps installed on Shopify Plus stores. App development partners can also request access to the Gift Card resource from the support page in the Partner Dashboard.
A gift card is an alternative payment method. Each gift card has a unique code that is entered during checkout. Its balance can be redeemed over multiple checkouts. Optionally, a gift card can assigned to a specific customer. Gift card codes cannot be retrieved after they're created—only the last four characters can be retrieved.
You can use the GiftCard resource to create, retrieve, and update gift cards for a store. After a gift card is created, only the expiry date, note, and template suffix can be updated.
Note
You can't delete gift cards, but you can disable them. You can't enable gift cards that were previously disabled.
What you can do with Gift Card
The Shopify API lets you do the following with the Gift Card resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-10/gift_cards.json Retrieves a list of gift cards
- GET /admin/api/2020-10/gift_cards/{gift_card_id}.json Retrieves a single gift card
- GET /admin/api/2020-10/gift_cards/count.json Retrieves a count of gift cards
- POST /admin/api/2020-10/gift_cards.json Creates a gift card
- PUT /admin/api/2020-10/gift_cards/{gift_card_id}.json Updates an existing gift card
- POST /admin/api/2020-10/gift_cards/{gift_card_id}/disable.json Disables a gift card
- GET /admin/api/2020-10/gift_cards/search.json?query=last_characters:mnop Searches for gift cards
Gift Card properties
api_client_id |
The ID of the app that issued the gift card, if it was issued by an app. |
balance |
The balance of the gift card. |
code |
The gift card code, which is a string of alphanumeric characters. For security reasons, this is available only upon creation of the gift card. (minimum: 8 characters, maximum: 20 characters) |
created_at |
The date and time (ISO 8601 format) when the gift card was created. |
currency |
The currency of the gift card. |
customer_id |
The ID of a customer who is associated with this gift card. |
disabled_at |
The date and time (ISO 8601 format) when the gift card was disabled. |
expires_on |
The date ( |
id |
The ID of the gift card. |
initial_value |
The initial value of the gift card when it was created. |
last_characters |
The last four characters of the gift card code. Because gift cards are alternative payment methods, the full code cannot be retrieved. |
line_item_id |
The ID of the line item that caused the creation of this gift card, if it was created by an order. |
note |
The text of an optional note that a merchant can attach to the gift card. Not visible to customers. |
order_id |
The ID of the order that caused the creation of this gift card, if it was created by an order. |
template_suffix |
The suffix of the Liquid template that's used to render the gift card online. For example, if the value is |
user_id |
The ID of the user that issued the gift card, if it was issued by a user. |
updated_at |
The date and time (ISO 8601 format) when the gift card was last modified. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
status
|
Retrieve gift cards with a given status. Valid values:
|
limit
|
The maximum number of results to show. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve a list of all gift cards
GET /admin/api/2020-10/gift_cards.json
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 283097216,
"balance": "0.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0y0y",
"order_id": null
},
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a list of all enabled gift cards
GET /admin/api/2020-10/gift_cards.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a single gift card
GET /admin/api/2020-10/gift_cards/48394658.json
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
status
|
Count gift cards with a given status. Valid values:
|
Retrieve a count of all gift cards
GET /admin/api/2020-10/gift_cards/count.json
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Retrieve a count of enabled gift cards
GET /admin/api/2020-10/gift_cards/count.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Create a gift card with a custom code
POST /admin/api/2020-10/gift_cards.json
{
"gift_card": {
"note": "This is a note",
"initial_value": 100.0,
"code": "ABCD EFGH IJKL MNOP",
"template_suffix": "gift_cards.birthday.liquid"
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936328,
"balance": "100.00",
"created_at": "2021-02-22T17:39:27-05:00",
"updated_at": "2021-02-22T17:39:27-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": "This is a note",
"expires_on": null,
"template_suffix": "gift_cards.birthday.liquid",
"last_characters": "mnop",
"order_id": null,
"code": "abcdefghijklmnop"
}
}
Create a gift card with an automatically generated code
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936329,
"balance": "25.00",
"created_at": "2021-02-22T17:39:33-05:00",
"updated_at": "2021-02-22T17:39:33-05:00",
"currency": "USD",
"initial_value": "25.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "928b",
"order_id": null,
"code": "bdb25c3aab82928b"
}
}
Updates an existing gift card.
The gift card's balance can't be changed via the API. You can change only the expiry date, note, and template suffix.
Update the note of a gift card
PUT /admin/api/2020-10/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"note": "Updating with a new note"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:40-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": "Updating with a new note",
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Update the expiry date of a gift card
PUT /admin/api/2020-10/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"expires_on": "2020-01-01"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:42-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-01-01",
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Disable a gift card
POST /admin/api/2020-10/gift_cards/48394658/disable.json
{
"gift_card": {
"id": 48394658
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T17:39:43-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": "2021-02-22T17:39:43-05:00",
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
Searches for gift cards that match a supplied query. The following fields are indexed by search:
created_at
updated_at
disabled_at
balance
initial_value
amount_spent
email
last_characters
Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
order
|
The field and direction to order results by. (default:disabled_at DESC )
|
query
|
The text to search for. |
limit
|
The maximum number of results to retrieve. (default:50 , maximum: 250 )
|
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve all gift cards with the last characters "mnop"
GET /admin/api/2020-10/gift_cards/search.json?query=last_characters:mnop
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 1063936331,
"balance": "10.00",
"created_at": "2021-02-22T17:39:50-05:00",
"updated_at": "2021-02-22T17:39:50-05:00",
"currency": "USD",
"initial_value": "10.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "mnop",
"order_id": null
}
]
}
Shopify Plus
The Gift Card resource is available for private apps installed on Shopify Plus stores. As of API version 2021-04, the Gift Card resource is also available for custom apps installed on Shopify Plus stores. App development partners can also request access to the Gift Card resource from the support page in the Partner Dashboard.
A gift card is an alternative payment method. Each gift card has a unique code that is entered during checkout. Its balance can be redeemed over multiple checkouts. Optionally, a gift card can assigned to a specific customer. Gift card codes cannot be retrieved after they're created—only the last four characters can be retrieved.
You can use the GiftCard resource to create, retrieve, and update gift cards for a store. After a gift card is created, only the expiry date, note, and template suffix can be updated.
Note
You can't delete gift cards, but you can disable them. You can't enable gift cards that were previously disabled.
What you can do with Gift Card
The Shopify API lets you do the following with the Gift Card resource. More detailed versions of these general actions may be available:
- GET /admin/api/2021-01/gift_cards.json Retrieves a list of gift cards
- GET /admin/api/2021-01/gift_cards/{gift_card_id}.json Retrieves a single gift card
- GET /admin/api/2021-01/gift_cards/count.json Retrieves a count of gift cards
- POST /admin/api/2021-01/gift_cards.json Creates a gift card
- PUT /admin/api/2021-01/gift_cards/{gift_card_id}.json Updates an existing gift card
- POST /admin/api/2021-01/gift_cards/{gift_card_id}/disable.json Disables a gift card
- GET /admin/api/2021-01/gift_cards/search.json?query=last_characters:mnop Searches for gift cards
Gift Card properties
api_client_id |
The ID of the app that issued the gift card, if it was issued by an app. |
balance |
The balance of the gift card. |
code |
The gift card code, which is a string of alphanumeric characters. For security reasons, this is available only upon creation of the gift card. (minimum: 8 characters, maximum: 20 characters) |
created_at |
The date and time (ISO 8601 format) when the gift card was created. |
currency |
The currency of the gift card. |
customer_id |
The ID of a customer who is associated with this gift card. |
disabled_at |
The date and time (ISO 8601 format) when the gift card was disabled. |
expires_on |
The date ( |
id |
The ID of the gift card. |
initial_value |
The initial value of the gift card when it was created. |
last_characters |
The last four characters of the gift card code. Because gift cards are alternative payment methods, the full code cannot be retrieved. |
line_item_id |
The ID of the line item that caused the creation of this gift card, if it was created by an order. |
note |
The text of an optional note that a merchant can attach to the gift card. Not visible to customers. |
order_id |
The ID of the order that caused the creation of this gift card, if it was created by an order. |
template_suffix |
The suffix of the Liquid template that's used to render the gift card online. For example, if the value is |
user_id |
The ID of the user that issued the gift card, if it was issued by a user. |
updated_at |
The date and time (ISO 8601 format) when the gift card was last modified. |
Endpoints
page
parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
status
|
Retrieve gift cards with a given status. Valid values:
|
limit
|
The maximum number of results to show. (default:50 , maximum: 250 )
|
since_id
|
Restrict results to after the specified ID. |
fields
|
Show only certain fields, specified by a comma-separated list of field names. |
Retrieve a list of all gift cards
GET /admin/api/2021-01/gift_cards.json
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 283097216,
"balance": "0.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0y0y",
"order_id": null
},
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a list of all enabled gift cards
GET /admin/api/2021-01/gift_cards.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"gift_cards": [
{
"id": 227709309,
"balance": "25.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "50.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": "2020-02-22",
"template_suffix": null,
"last_characters": "0e0e",
"order_id": null
},
{
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
]
}
Retrieve a single gift card
GET /admin/api/2021-01/gift_cards/48394658.json
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at": "2021-02-22T16:28:24-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": null,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "0d0d",
"order_id": null
}
}
status
|
Count gift cards with a given status. Valid values:
|
Retrieve a count of all gift cards
GET /admin/api/2021-01/gift_cards/count.json
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Retrieve a count of enabled gift cards
GET /admin/api/2021-01/gift_cards/count.json?status=enabled
View Response
HTTP/1.1 200 OK
{
"count": 3
}
Create a gift card with a custom code
POST /admin/api/2021-01/gift_cards.json
{
"gift_card": {
"note": "This is a note",
"initial_value": 100.0,
"code": "ABCD EFGH IJKL MNOP",
"template_suffix": "gift_cards.birthday.liquid"
}
}
View Response
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936328,
"balance": "100.00",
"created_at": "2021-02-22T17:39:27-05:00",
"updated_at": "2021-02-22T17:39:27-05:00",
"currency": "USD",
"initial_value": "100.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": "This is a note",
"expires_on": null,
"template_suffix": "gift_cards.birthday.liquid",
"last_characters": "mnop",
"order_id": null,
"code": "abcdefghijklmnop"
}
}
Create a gift card with an automatically generated code
HTTP/1.1 201 Created
{
"gift_card": {
"id": 1063936329,
"balance": "25.00",
"created_at": "2021-02-22T17:39:33-05:00",
"updated_at": "2021-02-22T17:39:33-05:00",
"currency": "USD",
"initial_value": "25.00",
"disabled_at": null,
"line_item_id": null,
"api_client_id": 755357713,
"user_id": null,
"customer_id": null,
"note": null,
"expires_on": null,
"template_suffix": null,
"last_characters": "928b",
"order_id": null,
"code": "bdb25c3aab82928b"
}
}
Updates an existing gift card.
The gift card's balance can't be changed via the API. You can change only the expiry date, note, and template suffix.
Update the note of a gift card
PUT /admin/api/2021-01/gift_cards/48394658.json
{
"gift_card": {
"id": 48394658,
"note": "Updating with a new note"
}
}
View Response
HTTP/1.1 200 OK
{
"gift_card": {
"id": 48394658,
"balance": "100.00",
"created_at": "2021-02-22T16:28:24-05:00",
"updated_at"