Skip to main content

Proration preview

Endpoint for previewing the proration of a Subscription change. Nothing is saved and no money moves, the response only shows what the change would produce. See Proration for the rules behind the numbers.

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/subscription/{subscription_id}/proration-preview

Request Parameters

Every parameter is optional. An omitted parameter falls back to the current value of the Subscription.

NameDescriptionTypeRequired
amountThe recurring amount you plan to set on the Subscription.uint64
initial_amountThe initial amount you plan to set on the Subscription.uint64
proration_behaviorBehavior to preview with. Possible values: none, create_prorations, immediate_action. If it is omitted, the Plan's proration_behavior is used.string
billing_cycleThe billing cycle you plan to set. A changed billing cycle makes proration impossible, the response comes back with the reason in error.string
billing_factorThe billing factor you plan to set. A changed billing factor makes proration impossible, the response comes back with the reason in error.uint64

Response Fields

NameDescription
proration_behaviorThe behavior the preview was calculated with, after the Plan fallback was resolved.
change_dateThe date the change would be applied on.
billing_period_startStart of the current billing period.
billing_period_endEnd of the current billing period, the next bill date.
days_in_periodNumber of days in the current billing period.
days_remainingNumber of days left from the current billing period.
old_amountThe amount the current period was billed with.
new_amountThe amount you would set.
credit_amountThe unused part of old_amount.
charge_amountThe same remaining part of new_amount.
net_amountcharge_amount minus credit_amount. Positive means the customer owes, negative means the customer is credited.
immediate_charge_amountThe part of net_amount that would be charged right away. Only filled for immediate_action with a positive net_amount.
currencyCurrency of the Subscription.
current_customer_balanceThe Customer's pending proration balance before the change. If the Subscription has no Customer, only its own pending adjustments are counted.
resulting_customer_balanceThe Customer's pending proration balance after the change.
errorPresent only when the change cannot be prorated. It holds the reason, and every calculated amount stays zero.

Response

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

Example Usage

proration-preview.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 subscription_id = '';
const url = `https://api.reverepayments.dev/api/v1/groups/${group_id}/revere_pay/${linked_account_id}/recurring/subscription/${subscription_id}/proration-preview`;
fetch(url, requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('error', error));

Example Request

{
"amount": 5000,
"proration_behavior": "create_prorations"
}

Example Success Response

{
"data": {
"proration_behavior": "create_prorations",
"change_date": "2026-06-13T00:00:00Z",
"billing_period_start": "2026-05-31T00:00:00Z",
"billing_period_end": "2026-06-30T00:00:00Z",
"days_in_period": 30,
"days_remaining": 18,
"old_amount": 2000,
"new_amount": 5000,
"credit_amount": 1200,
"charge_amount": 3000,
"net_amount": 1800,
"immediate_charge_amount": 0,
"currency": "USD",
"current_customer_balance": 0,
"resulting_customer_balance": 1800
}
}