Documentation · Introduction

Introduction

4FangPay Merchant API supports the pay-in cashier and two payout modes: Cashier and Direct.

  • Create a pay-in cashier: Call Create pay-in (POST /api/v1/pay/create), then let the user choose a payment channel and complete payment.
  • Payout Cashier: Call Payout Cashier (POST /api/v1/payout/create), then let the user choose a channel, confirm beneficiary data, and submit the payout.
  • Payout Direct: Call Payout Direct(the same POST /api/v1/payout/create), where the merchant server submits complete beneficiary data in one request and creates a formal order directly.

After Cashier mode creates a session, the merchant gives the returned payment_url to the user. The platform creates a formal order only after the user selects a channel and confirms the submission in the cashier. Direct mode does not return payment_url; the creation endpoint returns a formal order directly. For both modes, use the order query or asynchronous notification as the transaction result.

Before creating a pay-in or Payout Cashier session, the platform checks merchant-channel bindings, environment, currency, payment type, amount limits, effective rates, and bank/payment-method mappings. If no available channel matches, the API returns an error without saving a new session or returning payment_url. Pay-ins do not check the merchant balance. Payouts require the available balance in the same currency to cover the principal and matched-channel merchant fee; otherwise 40001 / error.insufficient_balance is returned. Cashier data may be completed in the cashier according to the rules; Direct requires complete beneficiary data in the creation request.

For global matching creation without a specified channel_code, an amount below the overall minimum configured across currently matching channels returns 40002, and an amount above the overall maximum returns 40003. The minimum is the smallest channel min_amount, and the maximum is the largest channel max_amount. message displays the currency and amount directly, for example amount below minimum (MYR 10.00) or amount above maximum (MYR 2000.00). If a boundary is unconfigured, that side is unlimited. Amounts within the overall range must still pass channel, API Key, merchant, rate, bank, and balance validation; the range does not guarantee order creation.

Banks, e-wallets, and payment schemes/methods use platform codes and are identified by currency + code. For platform catalogs, see Platform payment codes,Currency catalog and Bank and payment code catalog. The available transaction options for the current key are determined by Available channel options ; a catalog entry does not mean the transaction capability is enabled.

Read and integrate#

Integration flow#

  1. Prepare credentials
  2. Verify signing
  3. Integrate creation and queries
  4. Implement Notify
  5. Test the cashier integration
  1. Obtain the test environment's API Base URL, merchant_id, api_key, and api_secret.
  2. Read Integration and authentication and Responses and order conventions, and verify your signing implementation with the fixed signature example.
  3. Integrate pay-in,Payout Cashier or Payout Direct creation and query endpoints according to your use case.
  4. Follow Asynchronous notifications to implement Notify signature verification, deduplication, status updates, and acknowledgment.
  5. Use Complete examples and tools to complete integration testing in the test environment.

Transaction flow (pay-in / payout)#

The following is the normal cashier transaction flow. Queries and Notify are two independent result-synchronization paths; you do not need to wait for both.

  1. Merchant server: create a sessionGenerate and store merchant_order_no, then call pay-in /api/v1/pay/create or payout /api/v1/payout/create.
  2. Platform: return the cashier URLStore platform_order_no and payment_url. At this point it is only a cashier session; no formal order has been created.
  3. User: confirm in the cashierOpen payment_url, choose a channel, complete the required data, and confirm submission. The platform creates a formal order and processes the transaction.
  4. Merchant: synchronize the transaction result
    Active queryThe server calls pay-in /api/v1/pay/query or payout /api/v1/payout/query to read the session or formal-order status.
    Asynchronous NotifyAfter configuring a notification URL, receive platform notifications; verify the signature, validate and deduplicate the event, then return SUCCESS after successful processing.
  5. Merchant: update the order and display the resultFor pay-in, paid means success; for payout, success means success. Successful session creation, receiving a cashier URL, or a browser return does not mean the transaction succeeded.

Queries and result handling#

Scenario Integration-side handling
Query returns checkout_mode=cashier No formal order exists yet. Based on the session status, wait for a selection, continue querying, or handle session expiry.
Formal order is still processing For pay-in: created / pending / manual_review. For payout: reviewing / processing. Continue querying or wait for a notification.
Transaction result received Update the local order according to the pay-in or payout status definition. Do not process the same result twice through a query and Notify. Process correction notifications by revision.
Creation timeout, disconnect, or indeterminate result Query with the original order number. Do not switch order numbers and create a duplicate.
User returns from the cashier Query the current result on the server before displaying it to the user. Do not infer success from the redirect.

For status definitions, see Responses and order conventions,pay-in query and payout query; for notification handling, see Asynchronous notifications.

Search docs