Understand HaiPay subscription integration modes, business requirements, launch rules, and core API entry points before you start building recurring card payments.
Use this file to discover all available pages before exploring further.
HaiPay subscription payments are designed for memberships, recurring services, and auto-renew billing. This page now acts as a cleaner landing page: it helps you choose an integration mode, understand launch constraints, and jump into the right API Reference pages instead of scanning a long wall of duplicated parameter tables.
Quick Start
Review the integration path, required product capabilities, and reading order.
Integration Modes
Compare Apple Pay / Google Pay, card component, and combined mode.
Core APIs
Jump directly to create, query, cancel, and refund endpoints.
Provide a clear subscription entry, billing-cycle explanation, and cancellation entry.
Notify users outside the platform after subscription activation and before or after each recurring charge.
Show a subscription service agreement and obtain explicit user consent before starting recurring billing.
Keep customer support available, at minimum during the operating hours of your main markets.
Consumers may dispute card charges within 180 days after the transaction date.
Each dispute incurs a 20 USD dispute handling fee.
If you choose to defend the dispute, an additional 20 USD rebuttal fee applies.
If the rebuttal succeeds, HaiPay refunds the rebuttal fee; the original dispute fee is not refunded by default.
PCI DSS strictly prohibits embedding card input pages inside WebView or iframe. Always collect card details and complete authorization in a trusted browser environment to avoid compliance and data-security issues.
Subscription payments offer two integration modes: PayUrl Redirect (server obtains an authorization URL and redirects the user to HaiPay’s hosted payment page) and JS CDN Embed (uses a client token to embed payment components directly in your own page). Choose based on your checkout design and frontend capabilities.
3
Connect APIs, callbacks, and cancellation
After creating a subscription, you still need subscription query, recurring callback handling, and a user-facing cancellation flow. The detailed fields and debug entry points are linked in the API cards below.
The simplest integration path. After your server calls the subscription create API, use the returned payUrl to redirect the user to HaiPay’s hosted payment page where they complete authorization and the first payment.Integration Flow
1
Server calls the subscription create API
Your server sends a Subscription Create request to HaiPay with the required parameters such as amount, cycle, and callback URLs.
2
Get payUrl and redirect
The API response includes a payUrl field. Redirect the user’s browser to that URL.
3
User completes payment
The user fills in card details and authorizes the subscription on HaiPay’s hosted page. After payment, HaiPay redirects the user back to your callBackUrl and sends an asynchronous notification to your notifyUrl.
Example code (frontend redirect after server obtains payUrl)
// Assuming your server has called the subscription create API// and returned the payUrl to the frontendconst payUrl = response.data.payUrl;// Redirect in the current windowwindow.location.href = payUrl;// Or open in a new window// window.open(payUrl, '_blank');
When to choose it
You want the fastest possible subscription integration with minimal frontend changes.
You have no specific customization requirements for the payment page UI.
For mobile H5 scenarios, the redirect experience is usually sufficient.
Embed payment components directly in your own page using HaiPay JS scripts. After your server calls the subscription create API, use the returned clientToken to initialize the frontend component. Users complete payment without leaving your page.The JS CDN offers the following component types. Choose based on your checkout design:
Custom Combined Mode
Apple Pay / Google Pay (Deprecated Soon)
Credit Card (Deprecated Soon)
Similar to Combined Mode, but additionally supports switching between one-time payment and subscription payment via the mode parameter. Ideal for merchants who need to manage multiple payment scenarios with one integration.Scripthttps://cashier.haipay.top/js/composite-component_1.0.0.min.jsParameters
Parameter
Required
Description
sandbox
Yes
true for test, false for production
clientToken
Yes
Client token returned by the subscription create API
mode
Yes
Payment scenario: payment (one-time) or subscription (recurring)
showPayButton
No
Whether to display the credit card submit button. Default: false (hidden)
This component will be deprecated soon. Please use “Custom Combined Mode” instead.
Best for teams that already support wallet-based checkout and want a fast subscription authorization experience.Recommended scripthttps://cashier.haipay.top/js/applePayGooglePaySubscribe_1.0.0.min.jsKey parameters
Parameter
Required
Description
sandbox
Yes
true for test, false for production
clientToken
Yes
Client token
buttonType
No
Button text such as buy or subscribe
buttonTheme
No
Button theme such as black or white
buttonHeight
No
Button height, default 50
Typical events
ready: button rendered
error: initialization or payment error
paymentStatus: payment result callback (If you do not listen to this event, the component will process the payment result by default)
This component will be deprecated soon. Please use “Custom Combined Mode” instead.
Best when you want to render the subscription card form directly and control the submit action yourself.Recommended scripthttps://cashier.haipay.top/js/creditCardSubscription_1.0.0.min.jsKey parameters
Parameter
Required
Description
sandbox
Yes
true for test, false for production
clientToken
Yes
Client token
cardTheme
No
Form theme, default white
Typical events
ready: card component rendered
confirm: form submission result
paymentStatus: payment result callback (If you do not listen to this event, the component will process the payment result by default)
When the subscription status changes or a recurring deduction completes, HaiPay pushes an asynchronous notification to the notifyUrl provided in the subscription create request.
To ensure extensibility and compatibility, follow these callback parameter reception guidelines:
Do not declare a specific POJO object to receive callback parameters.
Must use a generic data structure (like JSONObject, Map, etc.) to parse parameters.
This design ensures that if callback fields are extended later, it will not affect your signature verification logic.
After receiving a notification, return SUCCESS (uppercase) in the response body.
Subscription Status Notification
Deduction Notification
Triggered when the subscription status changes (e.g., subscription activated, canceled, failed, etc.).
Total subscription duration cannot exceed 3 years regardless of cycle unit
Cycle unit
Apple Pay does not support W; use D + 7 for weekly billing
Payment type
Subscription flows use SUBSCRIPTION
User notifications
Notify users after activation and before or after recurring deductions
Cancellation
Production environments must provide a clear and accessible cancellation entry
Payment method parameters
In the subscription create API, inBankCode and paymentMethods are mutually exclusive: use inBankCode for a single payment method code, or paymentMethods for a comma-separated list of payment methods. paymentMethods currently only supports the front-end component combination mode
When should I use this page versus the API Reference?
Use this page to understand the product model, select an integration mode, and review the launch rules. When you are ready to build or debug, move to the Subscription API Reference for full field definitions, example payloads, and testing tools.
Why are cancellation and off-platform notifications mandatory for subscriptions?
Subscription payments create a higher dispute risk than one-time payments. Clear authorization, notification, and cancellation controls reduce chargebacks, complaints, and risk-review issues, and they are usually required for a stable production rollout.
How should I interpret Unsupported region: CN in production?
It usually means the current production configuration does not support that region, or the payment-method setup does not match the target market. Confirm your merchant configuration, target market, and payment-method mix first, then contact HaiPay support if needed.
How should I choose between PayUrl Redirect and JS CDN Embed?
If you want the fastest launch with minimal frontend changes, use PayUrl Redirect. If you need a custom checkout UI where users stay on your page, use JS CDN Embed. Both modes use the same subscription create API; the only difference is whether you use the returned payUrl or clientToken.
Should I use inBankCode or paymentMethods?
These two parameters are mutually exclusive — you cannot pass both, and you must pass at least one. Use inBankCode when only a single payment method is needed. Use paymentMethods when multiple payment methods are required (e.g., Combined Mode). Note that paymentMethods currently only supports the front-end component combination mode; for other modes, continue using inBankCode.
Which mode should I choose for a modern subscription page with the least frontend work?
If you go with JS CDN Embed, start with Combined Mode. It gives you a more complete checkout container, lowers the amount of frontend composition work, and is usually easier for users to understand.