Introduction

Overview

The Offline Top-up service lets your system fund an AlipayHK wallet through an offline channel. Because the outcome of an offline top-up can be temporarily indeterminate—the payment may already have been collected while the top-up result is not yet final—the service is designed around a single principle: funds are never collected without a corresponding receipt, and funds are never collected when the top-up does not succeed.

To guarantee this, the Offline Top-up service is exposed as three coordinated APIs that together form one closed, state-driven flow:

Stage API Responsibility
1. Consult consult Pre-check before charging to confirm whether a top-up can proceed
2. Create create Submit the top-up and create the fund order
3. Query query Resolve the final status of an order whose outcome is still uncertain

Each branch of the flow resolves to one of two definitive outcomes—either the payment is collected with a receipt issued, or no payment is collected and the top-up is reported as unsuccessful. No transaction is left in an unresolved state.

Process Flow

copy
Start
  │
  ▼
consult
  ├─ resultInfo.resultStatus ≠ 'S'  → No payment collected; top-up unsuccessful
  └─ resultInfo.resultStatus = 'S'  → proceed to create
                                       │
                                       ▼
                                     create
                                     ├─ resultStatus = 'S'   → Payment collected; success receipt issued
                                     ├─ resultStatus = 'F'   → proceed to query
                                     └─ other status         → Payment collected; compensation receipt issued
                                                                │
                                                                ▼
                                                              query
                                                              ├─ fundOrderStatus = 'SUCCESS' → Payment collected; compensation receipt issued
                                                              └─ otherwise                     → No payment collected; top-up unsuccessful

Stage Descriptions

1. Consult — the pre-charge gate. Before any funds are collected, the customer's eligibility for a top-up is checked. If the pre-check does not return success, the request is terminated and no payment is collected, preventing unnecessary charges.

2. Create — the main top-up request.

  • Returns success (resultStatus = 'S') → payment is collected and a success receipt is issued.
  • Returns failure (resultStatus = 'F') → because the fund status is not yet definitive, the flow proceeds to query for final verification.
  • Returns any other status → the payment is collected and a compensation receipt is issued, and the transaction is settled afterward.

3. Query — the closing step for uncertain outcomes. For orders whose create result is a failure or otherwise unresolved, the actual status of the fund order is retrieved:

  • If the order is SUCCESS (payment collected) → payment is collected and a compensation receipt is issued, so that every collected payment is matched with a receipt.
  • If the order is confirmed unsuccessful → no payment is collected and the top-up is reported as unsuccessful.

Key Benefits

  • Fund safety — No branch permits a payment to be collected without a matching receipt, structurally eliminating any mismatch between collected funds and issued receipts.
  • Final consistency — The query stage converts uncertain or exceptional create outcomes into a definitive end state.
  • Predictable customer experience — Both successful and compensation scenarios issue a receipt to the customer, while unsuccessful scenarios are identified early and never result in an unexplained charge.
  • Integrate with confidence — Three well-defined, state-driven APIs provide a clear integration path with definitive outcomes at every branch.