Skip to main content

Payment Plan Templates Service

Manage payment plan templates with the SDK. Templates define reusable payment plan configurations that can be used to create multiple payment plans.

Methods

getMany()

List payment plan templates.

const templates = await sdk.paymentPlanTemplates.getMany({
take: 10,
skip: 0,
});

getOne()

Get a specific payment plan template.

const template = await sdk.paymentPlanTemplates.getOne({
id: 'template-id',
});

createOne()

Create a new payment plan template.

const template = await sdk.paymentPlanTemplates.createOne({
// ... template configuration
name: 'Monthly Subscription',
// ... other fields
});

updateOne()

Update an existing payment plan template.

const updated = await sdk.paymentPlanTemplates.updateOne({
id: 'template-id',
// ... updated fields
});

syncOne()

Sync payment plan template with the payment provider.

const synced = await sdk.paymentPlanTemplates.syncOne({
id: 'template-id',
});

Examples

Create and Use Template

// 1. Create a template
const template = await sdk.paymentPlanTemplates.createOne({
name: 'Monthly Subscription',
// ... configuration
});

// 2. Use template to create payment plans
const plan = await sdk.paymentPlans.createOne({
merchantInternalCustomerCode: 'customer-123',
merchantPaymentPlanTemplateId: template.id,
// ... additional plan-specific configuration
});

List and Update Templates

// List all templates
const templates = await sdk.paymentPlanTemplates.getMany({});

// Update a template
if (templates.items.length > 0) {
await sdk.paymentPlanTemplates.updateOne({
id: templates.items[0].id,
name: 'Updated Template Name',
// ... other updates
});
}

See API Payment Plans for more information.