Applies a gift card to the cart. Gift cards are treated as a payment method, not a discount —
the cart total remains unchanged while amount_due is reduced.
For promotion discount codes, use the POST /carts/{cart_id}/discount_codes endpoint instead.
import { createClient } from '@spree/sdk'
const client = createClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const cart = await client.carts.giftCards.apply('cart_abc123', 'GC-ABCD-1234', {
token: '<token>',
}){
"id": "cart_UkLWZg9DAJ",
"market_id": null,
"number": "R144554045",
"token": "RuTHka2EQdEPmHa7PXXzb8EAr5c9vSivWun",
"email": "claribel.funk@townekuhlman.us",
"customer_note": null,
"currency": "USD",
"locale": "en",
"total_quantity": 1,
"item_total": "10.0",
"display_item_total": "$10.00",
"adjustment_total": "0.0",
"display_adjustment_total": "$0.00",
"discount_total": "0.0",
"display_discount_total": "$0.00",
"tax_total": "0.0",
"display_tax_total": "$0.00",
"included_tax_total": "0.0",
"display_included_tax_total": "$0.00",
"additional_tax_total": "0.0",
"display_additional_tax_total": "$0.00",
"total": "110.0",
"display_total": "$110.00",
"gift_card_total": "50.0",
"display_gift_card_total": "$50.00",
"amount_due": "60.0",
"display_amount_due": "$60.00",
"delivery_total": "100.0",
"display_delivery_total": "$100.00",
"warnings": [],
"store_credit_total": "50.0",
"display_store_credit_total": "-$50.00",
"covered_by_store_credit": false,
"current_step": "address",
"completed_steps": [],
"requirements": [],
"shipping_eq_billing_address": false,
"discounts": [],
"items": [
{
"id": "li_UkLWZg9DAJ",
"variant_id": "variant_UkLWZg9DAJ",
"quantity": 1,
"currency": "USD",
"name": "Product 1174034",
"slug": "product-1174034",
"options_text": "",
"price": "10.0",
"display_price": "$10.00",
"total": "10.0",
"display_total": "$10.00",
"adjustment_total": "0.0",
"display_adjustment_total": "$0.00",
"additional_tax_total": "0.0",
"display_additional_tax_total": "$0.00",
"included_tax_total": "0.0",
"display_included_tax_total": "$0.00",
"discount_total": "0.0",
"display_discount_total": "$0.00",
"pre_tax_amount": "10.0",
"display_pre_tax_amount": "$10.00",
"discounted_amount": "10.0",
"display_discounted_amount": "$10.00",
"display_compare_at_amount": "$0.00",
"compare_at_amount": null,
"thumbnail_url": null,
"option_values": [],
"digital_links": []
}
],
"fulfillments": [
{
"id": "ful_UkLWZg9DAJ",
"number": "H20393389861",
"tracking": "U10000",
"tracking_url": null,
"cost": "100.0",
"display_cost": "$100.00",
"total": "100.0",
"display_total": "$100.00",
"discount_total": "0.0",
"display_discount_total": "$0.00",
"additional_tax_total": "0.0",
"display_additional_tax_total": "$0.00",
"included_tax_total": "0.0",
"display_included_tax_total": "$0.00",
"tax_total": "0.0",
"display_tax_total": "$0.00",
"status": "pending",
"fulfillment_type": "shipping",
"fulfilled_at": null,
"items": [
{
"item_id": "li_UkLWZg9DAJ",
"variant_id": "variant_UkLWZg9DAJ",
"quantity": 1
}
],
"delivery_method": {
"id": "dm_UkLWZg9DAJ",
"name": "UPS Ground",
"code": "UPS_GROUND"
},
"stock_location": {
"id": "sloc_UkLWZg9DAJ",
"state_abbr": "NY",
"name": "Gordon Pfeffer",
"address1": "1600 Pennsylvania Ave NW",
"city": "Washington",
"zipcode": "20500",
"country_iso": "US",
"country_name": "United States of America",
"state_text": "NY"
},
"delivery_rates": [
{
"id": "dr_UkLWZg9DAJ",
"delivery_method_id": "dm_UkLWZg9DAJ",
"name": "UPS Ground",
"selected": true,
"cost": "100.0",
"total": "100.0",
"additional_tax_total": "0.0",
"included_tax_total": "0.0",
"tax_total": "0.0",
"display_cost": "$100.00",
"display_total": "$100.00",
"display_additional_tax_total": "$0.00",
"display_included_tax_total": "$0.00",
"display_tax_total": "$0.00",
"delivery_method": {
"id": "dm_UkLWZg9DAJ",
"name": "UPS Ground",
"code": "UPS_GROUND"
}
}
]
}
],
"payments": [
{
"id": "py_UkLWZg9DAJ",
"payment_method_id": "pm_UkLWZg9DAJ",
"response_code": "1-SC-20260526161400395109",
"number": "PGO55NWN",
"amount": "50.0",
"display_amount": "$50.00",
"status": "checkout",
"source_type": "store_credit",
"source_id": "credit_UkLWZg9DAJ",
"source": {
"id": "credit_UkLWZg9DAJ",
"amount": "50.0",
"amount_used": "0.0",
"amount_remaining": "50.0",
"display_amount": "$50.00",
"display_amount_used": "$0.00",
"display_amount_remaining": "$50.00",
"currency": "USD"
},
"payment_method": {
"id": "pm_UkLWZg9DAJ",
"name": "Store Credit",
"description": null,
"type": "store_credit",
"session_required": false,
"source_required": true
}
}
],
"billing_address": {
"id": "addr_EfhxLZ9ck8",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"address1": "203 Lovely Street",
"address2": "Northwest",
"postal_code": "10118",
"city": "New York",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "NY",
"state_abbr": "NY",
"quick_checkout": false,
"is_default_billing": false,
"is_default_shipping": false,
"state_name": "New York"
},
"shipping_address": {
"id": "addr_VqXmZF31wY",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"address1": "204 Lovely Street",
"address2": "Northwest",
"postal_code": "10118",
"city": "New York",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "NY",
"state_abbr": "NY",
"quick_checkout": false,
"is_default_billing": false,
"is_default_shipping": false,
"state_name": "New York"
},
"payment_methods": [
{
"id": "pm_UkLWZg9DAJ",
"name": "Store Credit",
"description": null,
"type": "store_credit",
"session_required": false,
"source_required": true
}
],
"gift_card": {
"id": "gc_UkLWZg9DAJ",
"code": "GIFTCODE1",
"status": "active",
"currency": "USD",
"amount": "50.0",
"amount_used": "50.0",
"amount_authorized": "0.0",
"amount_remaining": "0.0",
"display_amount": "$50.00",
"display_amount_used": "$50.00",
"display_amount_remaining": "$0.00",
"expires_at": null,
"redeemed_at": null,
"expired": false,
"active": true
},
"market": null
}Authorizations
Publishable API key for store access
JWT token for authenticated customers
Headers
Bearer token for authenticated customers
Order token for guest access
Unique key for request idempotency.
Path Parameters
Cart prefixed ID (e.g., cart_abc123)
Body
Gift card code to apply
"GC-ABCD-1234"
Response
gift card applied
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
import { createClient } from '@spree/sdk'
const client = createClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const cart = await client.carts.giftCards.apply('cart_abc123', 'GC-ABCD-1234', {
token: '<token>',
}){
"id": "cart_UkLWZg9DAJ",
"market_id": null,
"number": "R144554045",
"token": "RuTHka2EQdEPmHa7PXXzb8EAr5c9vSivWun",
"email": "claribel.funk@townekuhlman.us",
"customer_note": null,
"currency": "USD",
"locale": "en",
"total_quantity": 1,
"item_total": "10.0",
"display_item_total": "$10.00",
"adjustment_total": "0.0",
"display_adjustment_total": "$0.00",
"discount_total": "0.0",
"display_discount_total": "$0.00",
"tax_total": "0.0",
"display_tax_total": "$0.00",
"included_tax_total": "0.0",
"display_included_tax_total": "$0.00",
"additional_tax_total": "0.0",
"display_additional_tax_total": "$0.00",
"total": "110.0",
"display_total": "$110.00",
"gift_card_total": "50.0",
"display_gift_card_total": "$50.00",
"amount_due": "60.0",
"display_amount_due": "$60.00",
"delivery_total": "100.0",
"display_delivery_total": "$100.00",
"warnings": [],
"store_credit_total": "50.0",
"display_store_credit_total": "-$50.00",
"covered_by_store_credit": false,
"current_step": "address",
"completed_steps": [],
"requirements": [],
"shipping_eq_billing_address": false,
"discounts": [],
"items": [
{
"id": "li_UkLWZg9DAJ",
"variant_id": "variant_UkLWZg9DAJ",
"quantity": 1,
"currency": "USD",
"name": "Product 1174034",
"slug": "product-1174034",
"options_text": "",
"price": "10.0",
"display_price": "$10.00",
"total": "10.0",
"display_total": "$10.00",
"adjustment_total": "0.0",
"display_adjustment_total": "$0.00",
"additional_tax_total": "0.0",
"display_additional_tax_total": "$0.00",
"included_tax_total": "0.0",
"display_included_tax_total": "$0.00",
"discount_total": "0.0",
"display_discount_total": "$0.00",
"pre_tax_amount": "10.0",
"display_pre_tax_amount": "$10.00",
"discounted_amount": "10.0",
"display_discounted_amount": "$10.00",
"display_compare_at_amount": "$0.00",
"compare_at_amount": null,
"thumbnail_url": null,
"option_values": [],
"digital_links": []
}
],
"fulfillments": [
{
"id": "ful_UkLWZg9DAJ",
"number": "H20393389861",
"tracking": "U10000",
"tracking_url": null,
"cost": "100.0",
"display_cost": "$100.00",
"total": "100.0",
"display_total": "$100.00",
"discount_total": "0.0",
"display_discount_total": "$0.00",
"additional_tax_total": "0.0",
"display_additional_tax_total": "$0.00",
"included_tax_total": "0.0",
"display_included_tax_total": "$0.00",
"tax_total": "0.0",
"display_tax_total": "$0.00",
"status": "pending",
"fulfillment_type": "shipping",
"fulfilled_at": null,
"items": [
{
"item_id": "li_UkLWZg9DAJ",
"variant_id": "variant_UkLWZg9DAJ",
"quantity": 1
}
],
"delivery_method": {
"id": "dm_UkLWZg9DAJ",
"name": "UPS Ground",
"code": "UPS_GROUND"
},
"stock_location": {
"id": "sloc_UkLWZg9DAJ",
"state_abbr": "NY",
"name": "Gordon Pfeffer",
"address1": "1600 Pennsylvania Ave NW",
"city": "Washington",
"zipcode": "20500",
"country_iso": "US",
"country_name": "United States of America",
"state_text": "NY"
},
"delivery_rates": [
{
"id": "dr_UkLWZg9DAJ",
"delivery_method_id": "dm_UkLWZg9DAJ",
"name": "UPS Ground",
"selected": true,
"cost": "100.0",
"total": "100.0",
"additional_tax_total": "0.0",
"included_tax_total": "0.0",
"tax_total": "0.0",
"display_cost": "$100.00",
"display_total": "$100.00",
"display_additional_tax_total": "$0.00",
"display_included_tax_total": "$0.00",
"display_tax_total": "$0.00",
"delivery_method": {
"id": "dm_UkLWZg9DAJ",
"name": "UPS Ground",
"code": "UPS_GROUND"
}
}
]
}
],
"payments": [
{
"id": "py_UkLWZg9DAJ",
"payment_method_id": "pm_UkLWZg9DAJ",
"response_code": "1-SC-20260526161400395109",
"number": "PGO55NWN",
"amount": "50.0",
"display_amount": "$50.00",
"status": "checkout",
"source_type": "store_credit",
"source_id": "credit_UkLWZg9DAJ",
"source": {
"id": "credit_UkLWZg9DAJ",
"amount": "50.0",
"amount_used": "0.0",
"amount_remaining": "50.0",
"display_amount": "$50.00",
"display_amount_used": "$0.00",
"display_amount_remaining": "$50.00",
"currency": "USD"
},
"payment_method": {
"id": "pm_UkLWZg9DAJ",
"name": "Store Credit",
"description": null,
"type": "store_credit",
"session_required": false,
"source_required": true
}
}
],
"billing_address": {
"id": "addr_EfhxLZ9ck8",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"address1": "203 Lovely Street",
"address2": "Northwest",
"postal_code": "10118",
"city": "New York",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "NY",
"state_abbr": "NY",
"quick_checkout": false,
"is_default_billing": false,
"is_default_shipping": false,
"state_name": "New York"
},
"shipping_address": {
"id": "addr_VqXmZF31wY",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"address1": "204 Lovely Street",
"address2": "Northwest",
"postal_code": "10118",
"city": "New York",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "NY",
"state_abbr": "NY",
"quick_checkout": false,
"is_default_billing": false,
"is_default_shipping": false,
"state_name": "New York"
},
"payment_methods": [
{
"id": "pm_UkLWZg9DAJ",
"name": "Store Credit",
"description": null,
"type": "store_credit",
"session_required": false,
"source_required": true
}
],
"gift_card": {
"id": "gc_UkLWZg9DAJ",
"code": "GIFTCODE1",
"status": "active",
"currency": "USD",
"amount": "50.0",
"amount_used": "50.0",
"amount_authorized": "0.0",
"amount_remaining": "0.0",
"display_amount": "$50.00",
"display_amount_used": "$50.00",
"display_amount_remaining": "$0.00",
"expires_at": null,
"redeemed_at": null,
"expired": false,
"active": true
},
"market": null
}
