Skip to main content

Update plan

Endpoint for updating a Plan.

info

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

PUT /api/v1/groups/{group_id}/revere_pay/{linked_account_id}/recurring/plans/{plan_id}

info

Retry logic applies to subscriptions paid by credit card. Due to the nature and timeline of ACH payments, it is not relevant for the ACH payment method.

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 daily, weekly, monthly, quarterly, semiannual or annual.stringRequired
billing_factorBilling factor of the Billing Cycle. For daily Billing Cycles, it represents the interval in days (e.g. 7 runs every 7 days). For weekly, monthly, quarterly, semiannual and annual Billing Cycles, it must be 1.string
descriptionDescription of the Plan. Will be seen by end-users, make sure it is recognizable.stringRequired
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
proration_behaviorControls how mid-cycle billing adjustments are handled when subscriptions on this plan are changed. Possible values: none, create_prorations, immediate_action.string
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
trial_amountThe trial amount charged for the Plan at the beginning of the Trial period. Requires trial_period_days.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
retry_policyArray of objects containing a custom retry schedule used when retrying a subscription's charge after a failed card payment.object
retry_policy.stepsOrdered list of retry steps, one entry per retry attempt. The number of steps must match max_retry_count.object array
retry_policy.steps[].delay_daysNumber of days to wait before the next retry attempt runs. Must be greater than 0 and no more than 30. The sum of delay_days across all steps must not exceed 30.
update_subscriptionsUse it if you wish to update the values of your existing subscriptions with the given plan.booleanRequired
prorateIf true, the update takes effect immediately and charges the accurately prorated amount for the current partial billing cycle. This field only applies when update_subscriptions is also true.booleanRequired

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: 'PUT',
headers: headers,
redirect: 'follow',
body: {
// request body data
}
};
const group_id = '';
const linked_account_id = '';
const plan_id = '';
const url = `https://api.reverepayments.dev/api/v1/groups/${group_id}/revere_pay/${linked_account_id}/recurring/plans/${plan_id}`;
fetch(url, requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('error', error));

Example Request

{
"name": "Monthly Plan",
"amount": 20000,
"initial_amount": 10000,
"billing_factor": 1,
"billing_cycle": "monthly",
"duration": 12,
"description": "Support our cause",
"trial_amount": 1000,
"trial_period_days": 7,
"update_subscriptions": true,
"proration_behavior": "none",
"tax": 1000,
"shipping_amount": 2000,
"max_retry_count": 3,
"retry_policy": {
"steps": [{ "delay_days": 1 }, { "delay_days": 3 }, { "delay_days": 5 }]
}
}

Example Success Response

{
"id": "0204ea34-6c93-4990-9a9b-dfb372006ad6",
"name": "Monthly $2",
"duration": 12,
"amount": 20000,
"initial_amount": 10000,
"trial_amount": 1000,
"billing_cycle": "monthly",
"billing_factor": 1,
"linked_account_id": "<linked_account_id>",
"description": "Support our cause",
"tax": 1000,
"shipping_amount": 2000,
"custom_fields": null,
"created_at": "2024-04-11T15:11:16.975339Z",
"updated_at": "2024-04-11T15:11:16.975339Z",
"trial_period_days": 7,
"max_retry_count": 3,
"retry_policy": {
"steps": [{ "delay_days": 1 }, { "delay_days": 3 }, { "delay_days": 5 }]
},
"proration_behavior": "none"
}