Store Credit Accounts API Routes
A store credit account is a ledger of store credit transactions for a customer. They hold the customer's store credit balance, including their credit and debit amounts. Store credit accounts allow you to build features that let customers pay for items using their store credit balance, such as gift cards or loyalty points. These API routes allow admin users to manage store credit accounts, their transactions, and more.
Store Credit Account routes are only available when the loyalty plugin is installed.
GET /admin/store-credit-accounts#
List Store Credit Accounts
Retrieve a list of store credit accounts. The store credit accounts can be filtered by fields such as id. The store credit accounts can also be sorted or paginated.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Query parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields.
without prefix it will replace the entire default fields.
The fields and relations to retrieve separated by commas.
Learn more in the API reference.idstring | string[]Optionalcustomer_idstring | string[]Optionalcurrency_codestring | string[]Optionalcreated_atobjectOptionalupdated_atobjectOptional$andobject[]Optional$orobject[]OptionallimitnumberOptionaloffsetnumberOptionalorderstringOptional-.codestring | string[]Optionalwith_deletedbooleanOptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumberstore_credit_accountsobject[]The list of store credit accounts.
store_credit_accountsobject[]estimate_countnumberOptional400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/store-credit-accounts#
Create Store Credit Account
Create a store credit account.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Request body (application/json)
currency_codestringusdcustomer_idstringOptionalmetadataobjectOptionalRequest examples
Responses
200 OK
store_credit_accountobjectThe store credit account's details.
store_credit_accountobject400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/store-credit-accounts/{id}#
Get a Store Credit Account
Retrieve a store credit account by its ID. You can expand the store credit account's relations or select the fields that should be returned.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields.
without prefix it will replace the entire default fields.
The fields and relations to retrieve separated by commas.
Learn more in the API reference.idstring | string[]Optionalcustomer_idstring | string[]Optionalcurrency_codestring | string[]Optionalcreated_atobjectOptionalupdated_atobjectOptional$andobject[]Optional$orobject[]OptionallimitnumberOptionaloffsetnumberOptionalorderstringOptional-.codestring | string[]Optionalwith_deletedbooleanOptionalRequest examples
Responses
200 OK
store_credit_accountobjectThe store credit account's details.
store_credit_accountobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/store-credit-accounts/{id}/credit#
Add Credit to Store Credit Account
Add credit to a store credit account
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringRequest body (application/json)
amountnumbernotestringOptionalRequest examples
Responses
200 OK
store_credit_accountobjectThe store credit account's details.
store_credit_accountobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/store-credit-accounts/{id}/debit#
Debit a Store Credit Account
Debit an amount from a store credit account, deducting it from the customer's store credit balance. The debit is recorded as a debit transaction on the account that references the authenticated admin user.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringRequest body (application/json)
amountnumbernotestringOptionalRequest examples
Responses
200 OK
store_credit_accountobjectThe store credit account's details.
store_credit_accountobject400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/store-credit-accounts/{id}/transactions#
List Transactions
Retrieve a list of transactions in a store credit account. The transactions can be filtered by fields like FILTER FIELDS. The transactions can also be paginated.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
idstring | string[]Optionaltransaction_group_idstring | string[]Optionalcreated_atobjectOptionalupdated_atobjectOptionallimitnumberOptionaloffsetnumberOptionalorderstringOptional-.fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. Without prefix it will replace the entire default fields.$andobject[]Optional$orobject[]OptionalqstringOptionalwith_deletedbooleanOptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumbertransactionsobject[]The list of transactions.
transactionsobject[]estimate_countnumberOptional400, 401, 404, 409, 422, 500: an error response is returned.