Payment Plans Service
Manage recurring payment plans with the SDK.
Methods
getMany()
List payment plans.
const plans = await sdk.paymentPlans.getMany({
merchantInternalCustomerCode: 'customer-123',
});
getOne()
Get payment plan details.
const plan = await sdk.paymentPlans.getOne({
id: 'plan-id',
});
createOne()
Create a new payment plan.
const plan = await sdk.paymentPlans.createOne({
// ... payment plan configuration
merchantInternalCustomerCode: 'customer-123',
merchantPaymentPlanTemplateId: 'template-id', // optional
// ... other fields
});
cancelOne()
Cancel a payment plan.
const canceled = await sdk.paymentPlans.cancelOne({
merchantPaymentPlanId: 'plan-id',
});
syncOne()
Sync payment plan with the payment provider.
const synced = await sdk.paymentPlans.syncOne({
merchantPaymentPlanId: 'plan-id',
});
Examples
Create Payment Plan from Template
// 1. Get available templates
const templates = await sdk.paymentPlanTemplates.getMany({});
// 2. Create plan from template
const plan = await sdk.paymentPlans.createOne({
merchantInternalCustomerCode: 'customer-123',
merchantPaymentPlanTemplateId: templates.items[0].id,
// ... additional configuration
});
List and Cancel Plans
// List customer's payment plans
const plans = await sdk.paymentPlans.getMany({
merchantInternalCustomerCode: 'customer-123',
});
// Cancel a specific plan
if (plans.items.length > 0) {
await sdk.paymentPlans.cancelOne({
merchantPaymentPlanId: plans.items[0].merchantPaymentPlanId,
});
}
See API Payment Plans for more information.