Skip to main content

Create Plan

Endpoint for creating a Plan.

info

Please be aware that this endpoint requires a Manage Transactions API Key.

POST /api/v1/groups/{group_id}/revere_pay/{linked_account_id}/recurring/plans

Request Parameters

NameDescriptionTypeRequired
amountThe amount of the plan.uint64Required
initial_amountThe initial amount of the plan. This amount is only used for the first transaction of the plan, and then the amount will be used.uint64
billing_cycleBilling cycle of the plan. It can be annual, monthly or daily.stringRequired
billing_factorBilling factor of the Billing Cycle. It represents how often a given cycle is initiated. For example, 365 for a daily Billing Cycle means that it will run every 365th day.uint64
descriptionDescription of the Plan. Will be seen by end-users, make sure it is recognizable.string
durationNumber of cycles the plan will run for. 6 means that the plan will run for 6 cycles. Use 0 for endless plans.stringRequired
nameName of the Plan. Will be seen by end-users, make sure it is recognizable.stringRequired
taxThe amount of tax included in the Plan.uint64
shipping_amountThe amount of shipping included in the Plan.uint64
trial_period_daysNumber of days of the trial period.uint64
max_retry_countNumber of times the subscription should be tried to run. After the maximum retries, the subscription status will change to failed. Maximum value: 5uint64

Response

CodeDescription
200Success
400Bad Request / Validation error
500Internal Error

Example Usage

plans.js
var headers = new Headers();
headers.append('Authorization', 'API_KEY');

var requestOptions = {
method: 'POST',
headers: headers,
redirect: 'follow',
body: {
// request body data
}
};
const group_id = '';
const linked_account_id = '';
const url = `https://api.reverepayments.dev/api/v1/groups/${group_id}/revere_pay/${linked_account_id}/recurring/plans`;
fetch(url, requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('error', error));

Example Request

{
"name": "Monthly Plan",
"amount": 10000,
"initial_amount": 5000,
"billing_factor": 1,
"billing_cycle": "monthly",
"duration": 12,
"description": "Cover support for a year",
"tax": 1000,
"shipping_amount": 2000,
"trial_period_days": 0
}

Example Success Response

{
"id": "0204ea34-6c93-4990-9a9b-dfb372006ad6",
"name": "Monthly Plan",
"duration": 12,
"amount": 10000,
"initial_amount": 5000,
"billing_cycle": "monthly",
"billing_factor": 1,
"linked_account_id": "<linked_account_id>",
"description": "Cover support for a year",
"tax": 1000,
"shipping_amount": 2000,
"custom_fields": null,
"created_at": "2024-04-11T15:11:16.975339432Z",
"updated_at": "2024-04-11T15:11:16.975339432Z",
"trial_period_days": 0,
"max_retry_count": 0
}