Skip to main content

Overview

Create and manage recurring subscriptions with automatic billing. Handle plan changes, cancellations, and invoice management seamlessly.

Recurring Billing

Automatic billing on schedule with retry logic for failed payments

Flexible Plans

Multiple billing intervals (monthly, yearly) with customizable pricing

Plan Changes

Upgrade or downgrade with automatic proration handling

Invoice Management

Track all subscription invoices and payment history

Subscription Plans

Subscription plans define the pricing, billing frequency, and trial periods for your subscriptions. Create and manage plans before subscribing customers.

Create Plan

Create a new subscription plan with pricing and billing configuration.
cURL

Request Parameters

Billing Intervals

Amount format: Always use the smallest currency unit. For MXN/USD, that’s cents.
  • $99.99 MXN = 9999
  • $299.99 USD = 29999

Response

Get Plan

Retrieve details about a specific plan.
cURL

Response

Same structure as Create Plan response.

List Plans

List all subscription plans with filtering and pagination.
cURL

Query Parameters

Response

Update Plan

Update an existing plan’s settings.
cURL

Request Parameters

Cannot update: amount, currency, interval, or intervalCount. These are immutable after creation. Create a new plan for different pricing or billing frequency.
Updating a plan affects future subscriptions only. Existing subscriptions keep their original plan settings unless explicitly changed.

Response

Archive Plan

Deactivate a plan to prevent new subscriptions.
cURL
Archiving sets active: false. Existing subscriptions are not affected and continue billing normally. You can reactivate the plan by updating active: true.

Response

When to Archive

Stop offering a plan to new customers while keeping existing subscriptions active.
Temporarily disable plans that shouldn’t be available year-round.

Managing Subscriptions

Create Subscription

Create a new subscription for a customer with a specific plan and payment method.

Request Parameters

Response

Subscription Statuses

Get Subscription

Retrieve details about a specific subscription.

Response

List Subscriptions

List all subscriptions with filtering and pagination.

Query Parameters

Response

Update Subscription

Update subscription settings like payment method or cancellation behavior.

Request Parameters

At least one field must be provided. To change the plan, use the Change Plan endpoint instead.

Response

Cancel Subscription

Cancel a subscription immediately or at the end of the current billing period.

Request Parameters

Cancellation Behaviors

Customer loses access immediately. No refunds issued.
  • Status immediately set to CANCELED
  • canceledAt and endedAt timestamps recorded
  • No further billing
  • Customer loses access now

Response

List Subscription Invoices

Get all invoices for a specific subscription.

Query Parameters

Response

Invoice Statuses


Plan Changes & Proration

When a customer changes their subscription plan mid-cycle, Cheqpay calculates a fair adjustment (proration) so they only pay for what they use.

Upgrades

Charged immediately or added to next invoice, depending on your proration behavior

Downgrades

Always deferred to the next billing cycle. No immediate refund or charge.

Preview

See exact costs before committing with the preview endpoint

How Proration Works

When a customer upgrades mid-cycle, Cheqpay calculates:
  1. Credit for the unused portion of the old plan
  2. Charge for the prorated portion of the new plan
  3. Net amount = Charge - Credit
The calculation uses daily proration based on the billing period:
All amounts are in the smallest currency unit (cents). A net amount of 5000 means $50.00 MXN.
Example: Customer on Basic Plan ($99.99/mo) upgrades to Pro Plan ($299.99/mo) on day 15 of a 30-day cycle:
  • Credit for unused Basic: $99.99 x (15/30) = $50.00
  • Charge for prorated Pro: $299.99 x (15/30) = $150.00
  • Net proration: $100.00 (charged or deferred, depending on behavior)

Change Plan

Update a subscription to a different plan with automatic proration handling.

Request Parameters

Headers

Proration Behaviors

Deferred to next invoiceThe proration is calculated and stored on the subscription. When the next billing cycle runs, the proration amount is added to (or subtracted from) the invoice.
  • No immediate charge to the customer
  • Proration appears as an adjustment on the next invoice
  • Plan switches immediately, but billing adjustment is deferred
  • Supports accumulation: if a customer changes plans multiple times in the same cycle, all prorations combine into a single adjustment
Best for: Most plan changes, especially when you want a smooth customer experience without mid-cycle charges.
What the next invoice looks like:
Charge immediatelyCreates a proration invoice and processes payment right away. The entire operation (invoice creation + payment + subscription update) is atomic — if the payment fails, nothing changes.
  • Immediate charge via the customer’s payment method on file
  • A proration invoice is created and paid instantly
  • If payment fails, the plan change is rejected (nothing changes)
  • Optionally reset the billing cycle with resetBillingCycle: true
Best for: Upgrades where you want to collect payment right away.
If the payment fails, the entire operation is rolled back. The subscription stays on the old plan, no invoice is created.
No prorationSwitch plans immediately without any proration calculation. The customer pays the full new plan amount at the next billing date, regardless of when they switched.
  • No credits or charges for unused time
  • Plan switches immediately
  • Next invoice at full new plan price
Best for: Trial conversions, promotional plan switches, or situations where proration isn’t desired.

Upgrade vs Downgrade Behavior

Downgrades are always deferred. Even if you send prorationBehavior: "always_invoice", a downgrade will be deferred to the next billing cycle. This ensures customers keep access to the plan they already paid for.

Billing Cycle Reset

When using always_invoice, you can optionally reset the billing cycle:
cURL
With resetBillingCycle: true:
  • The billing period restarts from today
  • The customer is charged the full new plan amount minus credit for unused old plan time
  • The next invoice date is recalculated from today
resetBillingCycle is only allowed with always_invoice behavior on upgrades. It will be rejected for downgrades, create_prorations, or none.

Response

Response for a downgrade:
For downgrades, the subscription.planId in the response still shows the current plan. The new (cheaper) plan will take effect when the next billing cycle starts.

Preview Plan Change

See the exact impact of a plan change before committing. This endpoint performs all calculations without modifying the subscription.

Request Parameters

Same as Change PlannewPlanId, prorationBehavior, prorationDate, resetBillingCycle.

Response

Preview for create_prorations:
The existingPendingProration and accumulatedNetAmount fields appear when using create_prorations. If the customer already has a pending proration from a previous plan change in the same cycle, these show the accumulated total.

Use Cases

Display the exact amount before they confirm.
Let customers choose how they’d like to pay.

List Plan Changes

Get the history of all plan changes for a subscription. Every plan change (upgrade, downgrade, or same-price swap) is recorded with full details.

Query Parameters

Response

Response Fields

Merchant Configuration

Your account has a default proration behavior that controls how plan changes are billed, plus a flag that controls whether individual API requests can override that default.
These settings are managed by Cheqpay and can’t be changed through the API. To update your account’s default proration behavior or whether request-level overrides are allowed, contact Cheqpay support.
As long as overrides are enabled for your account, you don’t need to change anything: just set the proration behavior per request with the prorationBehavior parameter, exactly as shown in the plan change examples above.

Configuration Options

Behavior Resolution

When a plan change request is made, the proration behavior is determined in this order:
  1. If the request includes prorationBehavior and allowBehaviorOverride is true → use the request value
  2. If the request includes prorationBehavior but allowBehaviorOverride is false → the request value is ignored, merchant default is used
  3. If no prorationBehavior in the request → use the merchant defaultBehavior
  4. If no merchant configuration exists → system default (create_prorations)

Common Scenarios

Upgrade with Immediate Charge

Customer upgrades and pays the difference immediately.

Upgrade with Deferred Proration

Customer upgrades now, pays the adjustment on the next invoice.

Downgrade (Always Deferred)

Customer downgrades. They keep the current plan until the billing period ends.

Multiple Plan Changes in One Cycle

When using create_prorations, multiple changes in the same billing cycle accumulate.
When using always_invoice, each change is charged independently. There’s no accumulation — each upgrade creates its own proration invoice.

Upgrade with Billing Cycle Reset

Start a fresh billing period from today after upgrading.

Cancel a Pending Downgrade with an Upgrade

If a customer downgrades and then upgrades before the next billing cycle, the downgrade is automatically canceled.

Webhooks

When a subscription plan changes, Cheqpay sends a subscription.plan_changed webhook event to your configured URL.
The webhook includes an x-webhook-signature header for verification. See Webhooks for setup and verification details.

Webhook fields

Error Handling

object[]
Common errors when working with subscriptions and plans

Plan Errors

Create Subscription Errors

Get/Update/Cancel Errors

Plan Change Errors

Best Practices

Show customers exactly what they’ll pay to avoid surprises and reduce support requests.
Protect against duplicate charges from network retries or double-clicks.
Charge customers right away when they upgrade to capture revenue immediately.
Apply credit at next billing to avoid refunds and maintain cash flow.
Plan names are shown to customers. Make them descriptive and easy to understand.
Link plans to your internal systems without exposing IDs to customers.
Amount, currency, and interval are immutable. Create new plans for price changes.
Listen for subscription events to keep your system in sync.
Pass the CVV when creating subscriptions to reduce fraud and improve authorization rates.
Default to end-of-period cancellation to maintain customer goodwill.
Track payment retries and handle failures gracefully.