Applies store credit to the order
import { createSpreeClient } from '@spree/sdk'
const client = createSpreeClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const order = await client.store.orders.addStoreCredit('or_abc123', 10.0, {
bearerToken: '<token>',
}){
"id": "or_UkLWZg9DAJ",
"number": "R684676898",
"state": "cart",
"checkout_steps": [
"address",
"delivery",
"payment",
"complete"
],
"token": "zGFBwQ4bs42sYW1pXbboGBup14ByQizvzmK",
"email": "tierra_morissette@schultzmetz.co.uk",
"special_instructions": null,
"currency": "USD",
"locale": "en",
"item_count": 1,
"state_lock_version": 1,
"shipment_state": null,
"payment_state": null,
"item_total": "10.0",
"display_item_total": "$10.00",
"ship_total": "100.0",
"display_ship_total": "$100.00",
"adjustment_total": "0.0",
"display_adjustment_total": "$0.00",
"promo_total": "0.0",
"display_promo_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",
"completed_at": null,
"created_at": "2026-03-05T20:52:43.940Z",
"updated_at": "2026-03-05T20:52:43.995Z",
"order_promotions": [],
"line_items": [
{
"id": "li_UkLWZg9DAJ",
"variant_id": "variant_UkLWZg9DAJ",
"quantity": 1,
"currency": "USD",
"name": "Product 1096529",
"slug": "product-1096529",
"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",
"promo_total": "0.0",
"display_promo_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",
"created_at": "2026-03-05T20:52:43.972Z",
"updated_at": "2026-03-05T20:52:43.972Z",
"compare_at_amount": null,
"thumbnail_url": null,
"option_values": [],
"digital_links": []
}
],
"shipments": [
{
"id": "ship_UkLWZg9DAJ",
"number": "H83092299658",
"state": "pending",
"tracking": "U10000",
"tracking_url": null,
"cost": "100.0",
"display_cost": "$100.00",
"shipped_at": null,
"created_at": "2026-03-05T20:52:43.978Z",
"updated_at": "2026-03-05T20:52:43.992Z",
"shipping_method": {
"id": "shpm_UkLWZg9DAJ",
"name": "UPS Ground",
"code": "UPS_GROUND"
},
"stock_location": {
"id": "sloc_UkLWZg9DAJ",
"state_abbr": "STATE_ABBR_314",
"name": "Quinn Kling",
"address1": "1600 Pennsylvania Ave NW",
"city": "Washington",
"zipcode": "20500",
"country_iso": "US",
"country_name": "United States of America",
"state_text": "STATE_ABBR_314"
},
"shipping_rates": [
{
"id": "shpr_UkLWZg9DAJ",
"shipping_method_id": "shpm_UkLWZg9DAJ",
"name": "UPS Ground",
"selected": true,
"cost": "100.0",
"display_cost": "$100.00",
"shipping_method": {
"id": "shpm_UkLWZg9DAJ",
"name": "UPS Ground",
"code": "UPS_GROUND"
}
}
]
}
],
"payments": [
{
"id": "py_UkLWZg9DAJ",
"payment_method_id": "pm_UkLWZg9DAJ",
"state": "checkout",
"response_code": "1-SC-20260305205244307338",
"number": "PTKOV2NG",
"amount": "10.0",
"display_amount": "$10.00",
"created_at": "2026-03-05T20:52:44.311Z",
"updated_at": "2026-03-05T20:52:44.311Z",
"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": "Store Credit",
"type": "Spree::PaymentMethod::StoreCredit",
"session_required": false
}
}
],
"bill_address": {
"id": "addr_EfhxLZ9ck8",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "306 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "STATE_ABBR_316",
"state_abbr": "STATE_ABBR_316",
"quick_checkout": false,
"state_name": "STATE_NAME_316"
},
"ship_address": {
"id": "addr_VqXmZF31wY",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "307 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "STATE_ABBR_317",
"state_abbr": "STATE_ABBR_317",
"quick_checkout": false,
"state_name": "STATE_NAME_317"
},
"payment_methods": [
{
"id": "pm_UkLWZg9DAJ",
"name": "Store Credit",
"description": "Store Credit",
"type": "Spree::PaymentMethod::StoreCredit",
"session_required": false
}
]
}Publishable API key for store access
JWT token for authenticated customers
Unique key for request idempotency. Duplicate requests with the same key return the cached response.
Amount to apply (optional - defaults to max available)
10
store credit applied
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 { createSpreeClient } from '@spree/sdk'
const client = createSpreeClient({
baseUrl: 'https://your-store.com',
publishableKey: '<api-key>',
})
const order = await client.store.orders.addStoreCredit('or_abc123', 10.0, {
bearerToken: '<token>',
}){
"id": "or_UkLWZg9DAJ",
"number": "R684676898",
"state": "cart",
"checkout_steps": [
"address",
"delivery",
"payment",
"complete"
],
"token": "zGFBwQ4bs42sYW1pXbboGBup14ByQizvzmK",
"email": "tierra_morissette@schultzmetz.co.uk",
"special_instructions": null,
"currency": "USD",
"locale": "en",
"item_count": 1,
"state_lock_version": 1,
"shipment_state": null,
"payment_state": null,
"item_total": "10.0",
"display_item_total": "$10.00",
"ship_total": "100.0",
"display_ship_total": "$100.00",
"adjustment_total": "0.0",
"display_adjustment_total": "$0.00",
"promo_total": "0.0",
"display_promo_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",
"completed_at": null,
"created_at": "2026-03-05T20:52:43.940Z",
"updated_at": "2026-03-05T20:52:43.995Z",
"order_promotions": [],
"line_items": [
{
"id": "li_UkLWZg9DAJ",
"variant_id": "variant_UkLWZg9DAJ",
"quantity": 1,
"currency": "USD",
"name": "Product 1096529",
"slug": "product-1096529",
"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",
"promo_total": "0.0",
"display_promo_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",
"created_at": "2026-03-05T20:52:43.972Z",
"updated_at": "2026-03-05T20:52:43.972Z",
"compare_at_amount": null,
"thumbnail_url": null,
"option_values": [],
"digital_links": []
}
],
"shipments": [
{
"id": "ship_UkLWZg9DAJ",
"number": "H83092299658",
"state": "pending",
"tracking": "U10000",
"tracking_url": null,
"cost": "100.0",
"display_cost": "$100.00",
"shipped_at": null,
"created_at": "2026-03-05T20:52:43.978Z",
"updated_at": "2026-03-05T20:52:43.992Z",
"shipping_method": {
"id": "shpm_UkLWZg9DAJ",
"name": "UPS Ground",
"code": "UPS_GROUND"
},
"stock_location": {
"id": "sloc_UkLWZg9DAJ",
"state_abbr": "STATE_ABBR_314",
"name": "Quinn Kling",
"address1": "1600 Pennsylvania Ave NW",
"city": "Washington",
"zipcode": "20500",
"country_iso": "US",
"country_name": "United States of America",
"state_text": "STATE_ABBR_314"
},
"shipping_rates": [
{
"id": "shpr_UkLWZg9DAJ",
"shipping_method_id": "shpm_UkLWZg9DAJ",
"name": "UPS Ground",
"selected": true,
"cost": "100.0",
"display_cost": "$100.00",
"shipping_method": {
"id": "shpm_UkLWZg9DAJ",
"name": "UPS Ground",
"code": "UPS_GROUND"
}
}
]
}
],
"payments": [
{
"id": "py_UkLWZg9DAJ",
"payment_method_id": "pm_UkLWZg9DAJ",
"state": "checkout",
"response_code": "1-SC-20260305205244307338",
"number": "PTKOV2NG",
"amount": "10.0",
"display_amount": "$10.00",
"created_at": "2026-03-05T20:52:44.311Z",
"updated_at": "2026-03-05T20:52:44.311Z",
"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": "Store Credit",
"type": "Spree::PaymentMethod::StoreCredit",
"session_required": false
}
}
],
"bill_address": {
"id": "addr_EfhxLZ9ck8",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "306 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "STATE_ABBR_316",
"state_abbr": "STATE_ABBR_316",
"quick_checkout": false,
"state_name": "STATE_NAME_316"
},
"ship_address": {
"id": "addr_VqXmZF31wY",
"firstname": "John",
"lastname": "Doe",
"full_name": "John Doe",
"address1": "307 Lovely Street",
"address2": "Northwest",
"city": "Herndon",
"zipcode": "35005",
"phone": "555-555-0199",
"company": "Company",
"country_name": "United States of America",
"country_iso": "US",
"state_text": "STATE_ABBR_317",
"state_abbr": "STATE_ABBR_317",
"quick_checkout": false,
"state_name": "STATE_NAME_317"
},
"payment_methods": [
{
"id": "pm_UkLWZg9DAJ",
"name": "Store Credit",
"description": "Store Credit",
"type": "Spree::PaymentMethod::StoreCredit",
"session_required": false
}
]
}