Build a subscriptions integration with Checkout

Create and manage subscriptions to accept recurring payments through Checkout.

What you'll build

This guide explains how to use Onerway Checkout to sell subscriptions. Through the subscription field, you will learn how to set up your subscription plans.

Integration Profile

Integration Type
Onerway Hosted Page
Integration Complexity
UI Customization
Limited
PCI Requirement
Not Required

Customization Options

  • Custom fonts
  • Custom background and border colors
  • Custom Logo

Subscription models

Onerway offers two subscription models:

Comparison ItemManaged SubscriptionSelf-Managed Subscription
Renewal ChargeExecuted automatically by OnerwayMerchant calls API manually
Failed Charge HandlingAutomatic retryHandled by merchant
Customer Management PortalSubscription management portal providedImplemented by merchant
Billing FlexibilityFixed amount/cycleFully adjustable

How to choose:

Business ScenarioRecommended Model
Fixed cycle and fixed amount (for example, membership subscriptions)Managed Subscription
Usage-based billing with variable amountsSelf-Managed Subscription
Quick launch without maintaining billing logicManaged Subscription

How to build a subscription checkout

1. Create a subscription product

First, create a subscription product in your payment platform and define the product name, price, and billing cycle. Make sure related tax and currency settings are configured as needed.

When creating the subscription, set subProductType to SUBSCRIBE in the Checkout API and pass the subscription parameter:

Required ParameterDescription
merchantCustIdUnique customer identifier used to associate the subscription
frequencyTypeBilling interval unit: D for days and M for months
frequencyPointBilling interval value
cycleCount or expireDateEither the total cycle count or the expiration date
{
  "subProductType": "SUBSCRIBE",
  "subscription": {
    "merchantCustId": "cust_10001",
    "frequencyType": "M",
    "frequencyPoint": 1,
    "cycleCount": 12
  }
}

2. Integrate the payment form

Use Checkout to create a hosted payment page for your subscription. The customer is redirected to Onerway's secure payment page to complete the transaction.

On the checkout page, the customer will:

  • Review the subscription details and amount
  • Select a payment method such as cards or digital wallets
  • Enter payment information and complete 3D Secure verification if required

Checkout features include:

  • Responsive layout for desktop and mobile
  • Support for multiple languages and currencies
  • Built-in 3D Secure verification
  • Secure handling of payment information

3. Handle payment results

After the payment is completed, Onerway redirects the customer back to your returnUrl. You still need to verify the payment result and update your system.

Verify the payment status

After payment completion, Onerway notifies the result in two ways:

Callback TypeTriggerProcessing Recommendation
Synchronous callbackCustomer returns to returnUrl after paymentDisplay the result page and do not rely on this status
Asynchronous notificationOnerway sends a webhook to notifyUrlVerify the signature, deduplicate the event, and update the subscription status

Subscription status should be based on webhook notifications. The synchronous callback is for display only.

Save the key fields

After the first successful payment, store the following fields for renewals, cancellation, payment method updates, and support inquiries:

DataPurpose
contractIdSubscription contract identifier used for query and management
tokenIdPayment token used to initiate later charges
merchantCustIdKeeps the user-to-subscription relationship
subscriptionManageUrlCustomer self-service page for hosted subscriptions

Handle webhooks

Set up a webhook endpoint to receive real-time notifications for subscription events:

EventMeaning
SUBSCRIPTION_INITIALFirst subscription payment succeeded
SUBSCRIPTION_RENEWALRenewal charge succeeded
SUBSCRIPTION_CHANGEDPlan changed
SUBSCRIPTION_CANCELEDSubscription canceled
SUBSCRIPTION_ENDEDSubscription ended naturally

4. Manage the subscription lifecycle

Managed subscription renewal

In the managed subscription model, Onerway automatically charges before the due date and sends a SUBSCRIPTION_RENEWAL webhook. Failed charges are retried automatically, and the subscription moves to pastdue. You only need to listen to the webhook and update local status.

Self-managed subscription renewal

In the self-managed subscription model, you need to call the charge API before the due date and pass contractId, tokenId, and merchantCustId. Charge results, retry strategies, and failure handling are maintained by you.

Subscription statuses

StatusMeaning
trialingTrial period in progress
activeActive and waiting for the next charge
pastduePayment overdue because the charge failed
canceledCanceled and remains active until the current cycle ends
endedEnded

Customer self-service management

Customers receive a subscription email from Onerway with a management entry. In that entry, they can view the subscription details, update the payment method, or cancel the subscription.