Credit grants
Create a credit grant
Creates a credit grant.
Authorization
bearerAuth AuthorizationBearer <token>
In: header
Request Body
application/json
Credit grant payload
type*string
Type of credit grant.
Value in
"paid" | "promotional"account_id*string
Account ID associated with the credit grant.
asset_code?string
Asset code of the credit grant. Required when currency is not set.
currency?string
Currency of the credit grant. Required when asset_code is not set.
Match
^[A-Z]{3}$grant_amount*integer
Granted amount in currency subunits or quantity of credit assets.
Range
0 <= valueinvoice_after_payment?boolean
Whether to create an invoice after payment. Defaults to true.
name?string|null
Name of the credit grant.
description?string|null
Description of the credit grant.
expires_at?string|null
Date when the credit grant expires.
Format
date-timewith_payment_link?boolean
Whether to create a payment link for the credit grant. Requires integration_id.
integration_id?string
Integration ID for payment processing.
allowed_payment_methods?array<string>
Payment methods to show on the payment page.
return_url?string
URL to redirect after payment.
metadata?|null
Additional data related to the credit grant.
Response Body
application/json
curl -X POST "https://api.sandbox.billingrails.com/v1/credit_grants" \ -H "Content-Type: application/json" \ -d '{ "type": "promotional", "account_id": "acc_IhMUl3rrZ3", "currency": "USD", "grant_amount": 5000, "invoice_after_payment": true, "with_payment_link": true, "integration_id": "int_IhMUl3rrZ3", "allowed_payment_methods": [ "card", "bank_transfer" ], "return_url": "https://example.com/return" }'{
"credit_grant": {
"object": "credit_grant",
"id": "cgr_IhMUl3rrZ3",
"type": "promotional",
"account_id": "acc_IhMUl3rrZ3",
"currency": "USD",
"status": "granted",
"payment_status": "comped",
"grant_amount": 5000,
"available_amount": 3000,
"created_at": "2025-02-14T17:33:40.843Z",
"effective_at": "2025-02-14T17:33:40.843Z",
"expires_at": "2025-03-14T17:33:40.843Z"
},
"meta": {
"request_id": "req_IhMUl3rrZ3"
}
}