Core Resources
Credits
The Credit Account object represents a set of positive and negative credit adjustments that when summed equal an available balance. Credit accounts may not have negative balances. A credit account may be associated with a customer, via the customer_id attribute. A customer may be associated with many credit accounts.
A credit adjustment represents a financial adjustment to the balance of a Credit Account. An adjustment of type ‘credit’ results in an increase in the available balance of a credit account, where an adjustment of type ‘debit’ results in a decrease.
Access to the Credits endpoints are only available for merchants using Retain.
#The credit account object
Attributes
- idintegerUnique numeric identifier for the Credit Account
- customer_idintegerUnique numeric identifier for the
customerassociated with thecredit_account. - available_balancestringThe dollar amount of available credit in the credit account, in the associated Store’s default currency as configured in Recharge
- created_atdatetimeThe date and time at which the credit account was created.
- currency_codestringThe currency code for the credit account.
- expires_atdatetimeThe date and time at which the credit account expires, and can no longer be adjusted.
- initial_valuestringThe initial value of the credit account at the time of creation.
- namestringThe name of the credit account
- typestringThe type of the credit account. Accepted values are
rewardsandmanual. - updated_atdatetimeThe date and time at which the credit account was last updated.
{
"credit_account": {
"id": 697470,
"customer_id": 36885098,
"available_balance": "10.00",
"created_at": "2024-07-08T20:40:30+00:00",
"currency_code": "USD",
"expires_at": null,
"initial_value": "1.55",
"name": "Reward Credit",
"type": "reward",
"updated_at": "2024-07-08T20:40:30+00:00"
}
}#Create a credit account
POST/credit_accounts
Create a new credit account.
Scope
write_credit_accountsBody parameters
- The ID of the customer to create the credit account for.
- expires_atdatetimeThe date and time at which the credit account expires, and can no longer be adjusted.
- initial_valuestringThe initial value of the credit account at the time of creation.
- The name of the credit account.
- The type of the credit account. Accepted values are
rewardandmanual.
curl 'https://api.rechargeapps.com/credit_accounts' \
-H 'X-Recharge-Version: 2021-11' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d 'customer_id=36885098' \
-d 'name=Reward Credit' \
-d 'type=reward' \
-d 'initial_value=10.00' \
-d 'expires_at=2026-01-01T00:00:00+00:00'{
"credit_account": {
"id": 697470,
"customer_id": 36885098,
"available_balance": "0.00",
"created_at": "2024-07-08T20:40:30+00:00",
"currency_code": "USD",
"expires_at": null,
"initial_value": "0.45",
"name": "Reward Credit",
"type": "reward",
"updated_at": "2024-07-08T20:40:30+00:00"
}
}#Retrieve a credit account
GET/credit_accounts/{id}
Retrieve one credit account using
credit_account_id.Scope
read_credit_accountscurl 'https://api.rechargeapps.com/credit_accounts/697470' \
-H 'X-Recharge-Version: 2021-11' \
-H 'X-Recharge-Access-Token: your_api_token'{
"credit_account": {
"id": 697470,
"customer_id": 36885098,
"available_balance": "0.00",
"created_at": "2024-07-08T20:40:30+00:00",
"currency_code": "USD",
"expires_at": null,
"initial_value": "0.45",
"name": "Reward Credit",
"type": "reward",
"updated_at": "2024-07-08T20:40:30+00:00"
}
}#Update a credit account
PUT/credit_accounts/{id}
Update a credit account name, expiration date or assign to a customer.
Scope
write_credit_accountsBody parameters
- namestringThe name of the credit account.
- customer_idstringThe ID of the customer to assign the credit account to.
- expires_atdatetimeThe date and time at which the credit account expires, and can no longer be adjusted.
curl 'https://api.rechargeapps.com/credit_accounts/697470' \
-H 'X-Recharge-Version: 2021-11' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d 'name=Reward Credit' \
-d 'customer_id=36885098' \
-d 'expires_at=2026-01-01T00:00:00+00:00'{
"credit_account": {
"id": 697470,
"customer_id": 36885098,
"available_balance": "0.00",
"created_at": "2024-07-08T20:40:30+00:00",
"currency_code": "USD",
"expires_at": null,
"initial_value": "0.45",
"name": "Reward Credit",
"type": "reward",
"updated_at": "2024-07-08T20:40:30+00:00"
}
}#List credit accounts
GET/credit_accounts
Return a list of credit accounts.
Scope
read_credit_accountsQuery parameters
- customer_idstringReturn the list of credit accounts linked to the given Recharge
customer_id - customer_idsstringReturn the list of credit accounts linked to any of the given Recharge
customer_ids. If passing multiple values, must be comma separated. Non-integer values will result in a 422 error - expires_at_mindatetimeReturn the list of credit accounts that expire after the given date (inclusive).
- expires_at_maxdatetimeReturn the list of credit accounts that expire before the given date (inclusive).
- limitstringThe amount of results. Default is 50 while the maximum is 250.
curl 'https://api.rechargeapps.com/credit_accounts' \
-H 'X-Recharge-Version: 2021-11' \
-H 'X-Recharge-Access-Token: your_api_token'{
"next_cursor": "eyJzdGFydGluZ19iZWZvcmVfaWQiOjQ5ODg2NywibGFzdF92YWx1ZSI6NDk4ODY3LCJzb3J0X2J5IjoiaWQtZGVzYyIsImN1cnNvcl9kaXIiOiJuZXh0In0",
"previous_cursor": null,
"credit_accounts": [
{
"id": 697470,
"customer_id": 36885098,
"available_balance": "0.00",
"created_at": "2024-07-08T20:40:30+00:00",
"currency_code": "USD",
"expires_at": null,
"initial_value": "0.45",
"name": "Reward Credit",
"type": "reward",
"updated_at": "2024-07-08T20:40:30+00:00"
}
]
}#Create a credit adjustment
POST/credit_accounts/{id}/credit_adjustments
Create a new credit adjustment for a specific credit account using
credit_account_id.Scope
write_credit_adjustmentsBody parameters
- The amount of the credit adjustment.
- notestringThe note for the credit adjustment.
- The type of the credit adjustment. Accepted values are
debitandcredit.Possible valuesdebitcredit
Response attributes
- idintegerUnique numeric identifier for the Credit Adjustment.
- credit_account_idintegerUnique numeric identifier for the Credit Account associated with the Credit Adjustment.
- amountstringThe dollar amount of the credit adjustment in the indicated currency.
- created_atdatetimeThe date and time at which the credit adjustment was created.
- created_byobjectThe resource that created the credit adjustment.
- currency_codestringThe currency code of the
credit_accountassociated with thecredit_adjustment. - ending_balancestringThe resulting balance of the associated
credit_accountafter thecredit_adjustmentwas applied. - notestringA note indicating additional information about the credit adjustment.
- typestringThe type of the adjustment. Accepted values are 'credit' or 'debit', where credit results in a higher available balance, and debit results in a lower available balance.
- updated_atdatetimeThe date and time at which the credit adjustment was updated.
curl -X POST 'https://api.rechargeapps.com/credit_accounts/697470/credit_adjustments' \
-H 'X-Recharge-Version: 2021-11' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d '{
"amount": "10.00",
"note": "Gift card purchase",
"type": "debit"
}'{
"credit_adjustment": [
{
"id": 4866849,
"credit_account_id": 697470,
"amount": "0.45",
"created_at": "2024-08-08T04:06:37+00:00",
"created_by": {
"resource_id": null,
"identifier": "API",
"type": "external"
},
"currency_code": "USD",
"ending_balance": "0.00",
"note": "Amount related with order Charge Id: 11888235",
"type": "debit",
"updated_at": "2024-08-08T04:06:37+00:00"
}
]
}#List Credit Adjustments for a Credit Account
GET/credit_accounts/{id}/credit_adjustments
Retrieve credit adjustments associated with specific credit account using
credit_account_id.Scope
read_credit_adjustmentsQuery parameters
- limitstringThe amount of results. Default is 50 while the maximum is 250.
Response attributes
- idintegerUnique numeric identifier for the Credit Adjustment.
- credit_account_idintegerUnique numeric identifier for the Credit Account associated with the Credit Adjustment.
- amountstringThe dollar amount of the credit adjustment in the indicated currency.
- created_atdatetimeThe date and time at which the credit adjustment was created.
- created_byobjectThe resource that created the credit adjustment.
- currency_codestringThe currency code of the
credit_accountassociated with thecredit_adjustment. - ending_balancestringThe resulting balance of the associated
credit_accountafter thecredit_adjustmentwas applied. - notestringA note indicating additional information about the credit adjustment.
- typestringThe type of the adjustment. Accepted values are 'credit' or 'debit', where credit results in a higher available balance, and debit results in a lower available balance.
- updated_atdatetimeThe date and time at which the credit adjustment was updated.
curl 'https://api.rechargeapps.com/credit_accounts/697470/credit_adjustments' \
-H 'X-Recharge-Version: 2021-11' \
-H 'X-Recharge-Access-Token: your_api_token'{
"next_cursor": null,
"previous_cursor": null,
"credit_adjustments": [
{
"id": 4866849,
"credit_account_id": 697470,
"amount": "0.45",
"created_at": "2024-08-08T04:06:37+00:00",
"currency_code": "USD",
"ending_balance": "0.00",
"note": "Amount related with shop order store.myshopify.com Address Id: 169902120 Charge Id: 1125729345",
"type": "debit",
"updated_at": "2024-08-08T04:06:37+00:00"
},
{
"id": 4719708,
"credit_account_id": 697470,
"amount": "0.45",
"created_at": "2024-07-08T20:40:31+00:00",
"currency_code": "USD",
"ending_balance": "0.45",
"note": "3% Cash back on curious tomatoes",
"type": "credit",
"updated_at": "2024-07-08T20:40:31+00:00"
}
]
}#List credit adjustments
GET/credit_adjustments
Retrieve a list of credit adjustments.
Scope
read_credit_adjustmentsQuery parameters
- idsstringReturn the list of credit adjustments linked to the given Recharge
ids. If passing multiple values, must be comma separated. Non-integer values will result in a 422 error - created_at_minstringReturn the list of credit adjustments created after the given date.
- created_at_maxstringReturn the list of credit adjustments created before the given date.
- includestringOnly supported value is
customer. Ifcustomeris included, the response will include the customer object. - limitstringThe amount of results. Default is 50 while the maximum is 250.
- undefinedstringSort the results by the given field.
- updated_at_minstringReturn the list of credit adjustments updated after the given date.
- updated_at_maxstringReturn the list of credit adjustments updated before the given date.
Response attributes
- idintegerUnique numeric identifier for the Credit Adjustment.
- credit_account_idintegerUnique numeric identifier for the Credit Account associated with the Credit Adjustment.
- amountstringThe dollar amount of the credit adjustment in the indicated currency.
- created_atdatetimeThe date and time at which the credit adjustment was created.
- created_byobjectThe resource that created the credit adjustment.
- currency_codestringThe currency code of the
credit_accountassociated with thecredit_adjustment. - ending_balancestringThe resulting balance of the associated
credit_accountafter thecredit_adjustmentwas applied. - notestringA note indicating additional information about the credit adjustment.
- typestringThe type of the adjustment. Accepted values are 'credit' or 'debit', where credit results in a higher available balance, and debit results in a lower available balance.
- updated_atdatetimeThe date and time at which the credit adjustment was updated.
curl 'https://api.rechargeapps.com/credit_adjustments' \
-H 'X-Recharge-Version: 2021-11' \
-H 'X-Recharge-Access-Token: your_api_token'{
"next_cursor": "eyJzdGFydGluZ19iZWZvcmVfaWQiOjQ4NjY4NDksImxhc3RfdmFsdWUiOjQ4NjY4NDksInNvcnRfYnkiOiJpZC1kZXNjIiwiY3Vyc29yX2RpciI6Im5leHQifQ",
"previous_cursor": null,
"credit_adjustments": [
{
"id": 4866849,
"credit_account_id": 697470,
"amount": "0.45",
"created_at": "2024-08-08T04:06:37+00:00",
"created_by": {
"resource_id": null,
"identifier": "API",
"type": "external"
},
"currency_code": "USD",
"ending_balance": "0.00",
"note": "Amount related with shop order shop.myshopify.com. Address Id: 169902120 Charge Id: 1125729345",
"type": "debit",
"updated_at": "2024-08-08T04:06:37+00:00"
}
]
}