Attributes

  • idstring

    Unique identifier for the object.

  • objectstring

    String representing the object’s type. Objects of the same type share the same value.

  • amountobject

    Amount of this credit grant.

  • applicability_configobject

    Configuration specifying what this credit grant applies to.

  • categoryenum

    The category of this credit grant. This is for tracking purposes and isn’t displayed to the customer.

    Possible enum values
    paid

    The credit grant was purchased by the customer for some amount.

    promotional

    The credit grant was given to the customer for free.

  • createdtimestamp

    Time at which the object was created. Measured in seconds since the Unix epoch.

  • customerstringExpandable

    ID of the customer receiving the billing credits.

  • effective_atnullable timestamp

    The time when the billing credits become effective-when they’re eligible for use.

  • expires_atnullable timestamp

    The time when the billing credits expire. If not present, the billing credits don’t expire.

  • livemodeboolean

    Has the value true if the object exists in live mode or the value false if the object exists in test mode.

  • metadataobject

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

  • namenullable string

    A descriptive name shown in dashboard.

  • test_clocknullable stringExpandable

    ID of the test clock this credit grant belongs to.

  • updatedtimestamp

    Time at which the object was last updated. Measured in seconds since the Unix epoch.

  • voided_atnullable timestamp

    The time when this credit grant was voided. If not present, the credit grant hasn’t been voided.

The Credit Grant object
{
"id": "credgr_test_61R9a6NUWsRmOW3RM41L6nFOS1ekDGHo",
"object": "billing.credit_grant",
"amount": {
"monetary": {
"currency": "usd",
"value": 1000
},
"type": "monetary"
},
"applicability_config": {
"scope": {
"price_type": "metered"
}
},
"category": "paid",
"created": 1726620803,
"customer": "cus_QrvQguzkIK8zTj",
"effective_at": 1729297860,
"expires_at": null,
"livemode": false,
"metadata": {},
"name": "Purchased Credits",
"test_clock": null,
"updated": 1726620803,
"voided_at": null
}

Creates a credit grant.

Parameters

  • amountobjectRequired

    Amount of this credit grant.

  • applicability_configobjectRequired

    Configuration specifying what this credit grant applies to.

  • categoryenumRequired

    The category of this credit grant.

    Possible enum values
    paid

    The credit grant was purchased by the customer for some amount.

    promotional

    The credit grant was given to the customer for free.

  • customerstringRequired

    ID of the customer to receive the billing credits.

  • effective_attimestamp

    The time when the billing credits become effective-when they’re eligible for use. It defaults to the current timestamp if not specified.

  • expires_attimestamp

    The time when the billing credits expire. If not specified, the billing credits don’t expire.

  • metadataobject

    Set of key-value pairs that you can attach to an object. You can use this to store additional information about the object (for example, cost basis) in a structured format.

  • namestring

    A descriptive name shown in the Dashboard.

Returns

Returns a credit grant.

POST /v1/billing/credit_grants
curl https://api.stripe.com/v1/billing/credit_grants \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:" \
-d name="Purchased Credits" \
-d customer=cus_QrvQguzkIK8zTj \
-d "amount[monetary][currency]"=usd \
-d "amount[monetary][value]"=1000 \
-d "amount[type]"=monetary \
-d "applicability_config[scope][price_type]"=metered \
-d category=paid
Response
{
"id": "credgr_test_61R9a6NUWsRmOW3RM41L6nFOS1ekDGHo",
"object": "billing.credit_grant",
"amount": {
"monetary": {
"currency": "usd",
"value": 1000
},
"type": "monetary"
},
"applicability_config": {
"scope": {
"price_type": "metered"
}
},
"category": "paid",
"created": 1726620803,
"customer": "cus_QrvQguzkIK8zTj",
"effective_at": 1729297860,
"expires_at": null,
"livemode": false,
"metadata": {},
"name": "Purchased Credits",
"test_clock": null,
"updated": 1726620803
}

Updates a credit grant.

Parameters

  • idstringRequired

    Unique identifier for the object.

  • expires_attimestamp

    The time when the billing credits created by this credit grant expire. If set to empty, the billing credits never expire.

  • metadataobject

    Set of key-value pairs you can attach to an object. You can use this to store additional information about the object (for example, cost basis) in a structured format.

Returns

Returns the updated credit grant.

POST /v1/billing/credit_grants/:id
curl https://api.stripe.com/v1/billing/credit_grants/credgr_test_61R9rpFu8SZkXPTkU41L6nFOS1ekDKoa \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:" \
-d "metadata[cost_basis]"="0.9" \
-d expires_at=1759302000
Response
{
"id": "credgr_test_61R9rpFu8SZkXPTkU41L6nFOS1ekDKoa",
"object": "billing.credit_grant",
"amount": {
"monetary": {
"currency": "usd",
"value": 1000
},
"type": "monetary"
},
"applicability_config": {
"scope": {
"price_type": "metered"
}
},
"category": "paid",
"created": 1726688933,
"customer": "cus_QsEHa3GKweMwih",
"effective_at": 1726688933,
"expires_at": 1759302000,
"livemode": false,
"metadata": {
"cost_basis": "0.9"
},
"name": "Purchased Credits",
"test_clock": null,
"updated": 1726688977,
"voided_at": null
}

Retrieves a credit grant.

Parameters

  • idstringRequired

    Unique identifier for the object.

Returns

Returns a credit grant.

GET /v1/billing/credit_grants/:id
curl https://api.stripe.com/v1/billing/credit_grants/credgr_test_61R9a6NUWsRmOW3RM41L6nFOS1ekDGHo \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"id": "credgr_test_61R9a6NUWsRmOW3RM41L6nFOS1ekDGHo",
"object": "billing.credit_grant",
"amount": {
"monetary": {
"currency": "usd",
"value": 1000
},
"type": "monetary"
},
"applicability_config": {
"scope": {
"price_type": "metered"
}
},
"category": "paid",
"created": 1726620803,
"customer": "cus_QrvQguzkIK8zTj",
"effective_at": 1729297860,
"expires_at": null,
"livemode": false,
"metadata": {},
"name": "Purchased Credits",
"test_clock": null,
"updated": 1726620803
}