Skip to main content

Documentation Index

Fetch the complete documentation index at: https://doc.haipay.net/llms.txt

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.

Quick Start

1

Confirm the business model and prerequisites

Start with the API Description Guide and the Subscription Process to confirm that your scenario is recurring billing rather than a one-time payment flow.
2

Choose the right integration mode

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.

Integration Modes

Subscription payments offer two integration modes. The key difference is who hosts the payment page:
ComparisonPayUrl RedirectJS CDN Embed
Payment pageRedirects to HaiPay’s hosted payment pageEmbeds payment components in your own page
Frontend effortAlmost zero, just handle the redirectRequires importing JS scripts and listening to events
UI controlLow, page style controlled by HaiPayHigh, customizable theme, layout, and interactions
Key response fieldUses payUrl from the responseUses clientToken from the response
Best forQuick integration, no custom payment page neededCustom checkout, seamless in-page payment experience
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 frontend
const payUrl = response.data.payUrl;

// Redirect in the current window
window.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.

Core APIs

For full request fields, response schemas, and live debugging, go directly to the API Reference pages:

Subscription Create

Create a subscription order, launch user authorization, and complete the first subscription payment.

Subscription Query

Check subscription status, platform subscription number, and deduction records.

Subscription Cancel

Cancel an active subscription and stop future recurring charges.

Asynchronous Notifications

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:
  1. Do not declare a specific POJO object to receive callback parameters.
  2. Must use a generic data structure (like JSONObject, Map, etc.) to parse parameters.
  3. 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.
Triggered when the subscription status changes (e.g., subscription activated, canceled, failed, etc.).
ParameterTypeDescription
typeStringNotification type, fixed as SUBSCRIPTION
appIdLongBusiness ID
currencyStringCurrency
subscriptionOrderIdStringMerchant subscription order ID
subscriptionNoStringPlatform subscription number
amountStringSubscription amount
statusIntegerSubscription status (1: Pending, 2: Active, 3: Failed, 4: Canceled, 5: Completed)
recurringIntervalStringRecurring cycle type (D/W/M/Y)
recurringIntervalCountIntegerRecurring cycle interval
subjectStringSubscription title
signStringSignature (verify using the business secret key corresponding to the currency)

Key Business Rules

ItemDetails
Amount limitSubscription amount range is 0.99 - 1000 USD
Max durationTotal subscription duration cannot exceed 3 years regardless of cycle unit
Cycle unitApple Pay does not support W; use D + 7 for weekly billing
Payment typeSubscription flows use SUBSCRIPTION
User notificationsNotify users after activation and before or after recurring deductions
CancellationProduction environments must provide a clear and accessible cancellation entry
Payment method parametersIn 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

Test Card Numbers

For use in test environment only
Simulate Successful Payment Use the following test card number. Enter any 3-digit CVC and any future expiration date:
  • 4242424242424242
Simulate Payment Failure Use the following test card number with invalid data:
  • Card Number: 4000000000009995
  • Invalid Month: 13
  • Invalid CVV: 99

Common Questions

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.
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.
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.
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.
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.
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.
Last modified on May 28, 2026