Add or remove store credit on a customer's balance
POST
/api/subscriptions/credits/adjustments
const url = 'https://api.usegro.co/api/subscriptions/credits/adjustments';const options = { method: 'POST', headers: { Authorization: 'Bearer <token>', 'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json' }, body: '{"profile_id":"example","subscription_id":"example","direction":"add","amount":1,"currency_code":"example","reason":"goodwill","note":"example","idempotency_key":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.usegro.co/api/subscriptions/credits/adjustments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "profile_id": "example", "subscription_id": "example", "direction": "add", "amount": 1, "currency_code": "example", "reason": "goodwill", "note": "example", "idempotency_key": "example" }'Writes one ledger row and moves the balance with it. amount is in the currency’s main unit, not cents (10.50 is $10.50), with at most two decimal places. reason is required; note is optional unless the reason is other. Removing more credit than the customer has (less any credit already on an order being billed) is refused with 422. Send the same idempotency_key on a retry so credit only moves once. Changes made with an API key are recorded with source api.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Media typeapplication/json
object
profile_id
required
string
subscription_id
string
direction
required
string
amount
required
number
currency_code
string
reason
required
string
note
string
idempotency_key
string
Responses
Section titled “Responses”Media typeapplication/json
object
data
object
data
required
object
id
required
string
created_at
string
type
required
string
currency_code
required
string
profile_id
required
string
profile
object
id
string
email
string
full_name
string
is_reversed
required
boolean
amount
required
number
balance_after
required
number
source
required
string
note
string
subscription_id
string
referral_id
string
earning_rule_id
string
shopify_order_id
string
reverses_transaction_id
string
actor_type
required
string
actor_name
string
subscription
object
number
string
id
string
order
object
number
number
id
string
Example
{ "data": { "data": { "type": "earned", "source": "referral", "reason": "goodwill", "actor_type": "user" } }}Not enough credit, or a missing note for the reason other
Media typeapplication/json