Create
Create a credit grant
client.v1.creditGrants.create(CreditGrantCreateParamsbody, RequestOptionsoptions?): dataIDCreditGrantCreateResponse
post/v1/credits/createGrant
Create a new credit grant
Parameters
bodycustomer_idstringexpires_atstringgrant_amountGrantAmountnamestringpaid_amountPaidAmountprioritynumbercredit_grant_typestringcustom_fieldsRecord<string, string>effective_atstringinvoice_datestringproduct_idsarrayreasonstringrollover_settingsRolloverSettingsuniqueness_keystringCreditGrantCreateParams
Returns
CreditGrantCreateResponse
import Metronome from '@metronome/sdk';
const client = new Metronome({
bearerToken: 'My Bearer Token',
});
const creditGrant = await client.v1.creditGrants.create({
customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
expires_at: '2022-04-01T00:00:00Z',
grant_amount: { amount: 1000, credit_type_id: '5ae401dc-a648-4b49-9ac3-391bb5bc4d7b' },
name: 'Acme Corp Promotional Credit Grant',
paid_amount: { amount: 5000, credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2' },
priority: 0.5,
credit_grant_type: 'trial',
effective_at: '2022-02-01T00:00:00Z',
reason: 'Incentivize new customer',
});
console.log(creditGrant.data);
200 Example
{
"data": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
}