Skip to main content
POST
/
credits
/
createGrant
Create a credit grant
curl --request POST \
  --url https://api.metronome.com/v1/credits/createGrant \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "customer_id": "9b85c1c1-5238-4f2a-a409-61412905e1e1",
  "grant_amount": {
    "amount": 1000,
    "credit_type_id": "5ae401dc-a648-4b49-9ac3-391bb5bc4d7b"
  },
  "name": "Acme Corp Promotional Credit Grant",
  "reason": "Incentivize new customer",
  "effective_at": "2022-02-01T00:00:00Z",
  "expires_at": "2022-04-01T00:00:00Z",
  "paid_amount": {
    "amount": 5000,
    "credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2"
  },
  "priority": 0.5,
  "credit_grant_type": "trial"
}'
{
  "data": {
    "id": "8b24d3dc-6db5-432d-9416-8439b3fbf242"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

The details of the credit grant to create.

customer_id
string<uuid>
required

the Metronome ID of the customer

grant_amount
object
required

the amount of credits granted

paid_amount
object
required

the amount paid for this credit grant

name
string
required

the name of the credit grant as it will appear on invoices

expires_at
string<date-time>
required

The credit grant will only apply to usage or charges dated before this timestamp

priority
number
required
uniqueness_key
string

Prevents the creation of duplicates. If a request to create a record is made with a previously used uniqueness key, a new record will not be created and the request will fail with a 409 error.

Required string length: 1 - 128
effective_at
string<date-time>

The credit grant will only apply to usage or charges dated on or after this timestamp

invoice_date
string<date-time>

The date to issue an invoice for the paid_amount.

reason
string
credit_grant_type
string
product_ids
string<uuid>[]

The product(s) which these credits will be applied to. (If unspecified, the credits will be applied to charges for all products.). The array ordering specified here will be used to determine the order in which credits will be applied to invoice line items

rollover_settings
object

Configure a rollover for this credit grant so if it expires it rolls over a configured amount to a new credit grant. This feature is currently opt-in only. Contact Metronome to be added to the beta.

custom_fields
object

Custom fields to attach to the credit grant.

Response

200 - application/json

Success

data
object
required
I