Skip to main content

Applying coupons

You can give customers discounts in your application by applying coupons to their subscriptions. Multiple coupons can be applied to a single subscription and the grantee will be charged the new rate from the following billing cycle onwards.

import { Salable } from '@salable/node-sdk';

const salable = new Salable('YOUR_SALABLE_API_KEY', 'v2');
await salable.subscriptions.addCoupon(
'YOUR_SUBSCRIPTION_UUID',
{ couponUuid: 'YOUR_COUPON_TO_APPLY_UUID' }
);

You can also programmatically remove coupons from subscriptions. Similarly with adding coupons, the pricing will be updated to reflect the new rate from the following billing cycle.

import { Salable } from '@salable/node-sdk';

const salable = new Salable('YOUR_SALABLE_API_KEY', 'v2');
await salable.subscriptions.removeCoupon('YOUR_SUBSCRIPTION_UUID', { couponUuid: 'YOUR_COUPON_UUID' });