import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: 'My Bearer Token',
});
const discount = await client.discounts.create({ amount: 0, type: 'percentage' });
console.log(discount.business_id);
{
"amount": 123,
"business_id": "<string>",
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"discount_id": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"restricted_to": [
"<string>"
],
"subscription_cycles": 123,
"times_used": 123,
"type": "percentage",
"usage_limit": 123
}
Create a discount for your account.
import DodoPayments from 'dodopayments';
const client = new DodoPayments({
bearerToken: 'My Bearer Token',
});
const discount = await client.discounts.create({ amount: 0, type: 'percentage' });
console.log(discount.business_id);
{
"amount": 123,
"business_id": "<string>",
"code": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"discount_id": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"restricted_to": [
"<string>"
],
"subscription_cycles": 123,
"times_used": 123,
"type": "percentage",
"usage_limit": 123
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Request body for creating a discount.
code
is optional; if not provided, we generate a random 16-char code.
Created discount
The response is of type object
.
Was this page helpful?