Alipay callbacks reading a stale database replica: primary checks and single credit

When payment is confirmed but your application cannot find the order, inspect its database route before recreating the order or delivering again. This is merchant-side architecture guidance, not a description of 稳付pay infrastructure.

Continue by topic

Confirm commercial terms and the authority boundary

Ask 稳付pay about WeChat Pay, Alipay and UnionPay; availability follows your formal configuration. Confirm fee basis, transaction and cumulative limits, and any exception-investigation costs. Replica lag does not change an existing quote. Merchant USDT settlement of CNY collections uses TRON/TRC20 only; confirm exchange basis, minimums, triggers and timing. Payment, customer credit and merchant settlement require separate evidence.

For a merchant-owned application with read/write splitting, complete business approval and account setup, obtain production parameters privately and review onboarding, query, callback and signature documents. Inventory the database roles used by order creation, callbacks, workers and support screens. A fixed sleep is not authoritative confirmation.

Collect evidence of the read route

Record a stable internal order reference, merchant scope, currency, amount and creation commit time. Diagnostic logs should identify the database role, read time and redacted request reference. PostgreSQL asynchronous replication can leave committed primary changes temporarily invisible on a standby; there is no universal safe waiting interval.

Example: DEMO-R exists on the primary but a replica returns no row. Check the same scoped reference on the authoritative writer, then examine routing and replication replay progress. Show “verification pending” to support staff and block automatic replacement orders. If the primary also has no row, isolate a missing-order case; do not invent a product or account from a notification.

Commit the unique update on the primary

Verify the callback using the formal contract, then check ownership, currency, amount and successful status. In a primary transaction, claim the payment, update the order and create a unique credit entry. Uniqueness must include business scope. These are internal design concepts, not gateway fields. Acknowledge only after the required durable result; investigate an unknown commit using the original primary record.

A replica still showing unpaid must not overwrite confirmed success or trigger another credit. Immediate displays may read the authoritative committed result. If you choose causal reads or replay waits, the database team must define timeout and fallback. If the primary is unavailable, retain pending verification and alert; an empty replica is not proof of payment failure.

Test lag and failure branches

In an isolated environment pause replica replay, repeat callbacks, disconnect after commit and misroute a read. DEMO-R should have one payment claim and one business credit; a temporarily pending display must not request another payment. Also test a genuinely absent primary order so it follows investigation rather than the replica-lag shortcut.

Reconcile authoritative payments, balance or entitlement entries and separate USDT settlement receipts. Retain replay recovery time and case ownership. After repair, rebuild derived displays from authoritative orders without changing original amounts or deleting conflicts. Missing data after a primary failover is a recovery-consistency incident requiring separate assessment, not merely a reason to wait longer.

Frequently asked questions

Can I redeliver once the replica catches up?

Check the primary delivery and ledger records first. Improved visibility does not create another fulfillment entitlement.

Should every read move to the primary?

Evaluate capacity and privileges for a controlled repair. Design long-term routing around consistency needs instead of unexpectedly overwhelming the writer.

References