Connecting a self-hosted digital delivery platform to payments
Integrating payments into a self-hosted digital delivery platform requires more than placing a payment QR code on a page: set prices on the server, assign a unique order number to each order, verify callback signatures and deliver each code only once. Missing a step can leave a paid customer without a code or cause the same code to be delivered twice.
Contents
Three things to fix when creating an order
- Read products and amounts only from the server. A buyer changing the displayed price must not change the actual amount due.
- Generate the merchant order number in your own system and ensure it is unique.
- Do not mark a code as sold at this point. An unpaid order is not delivered, and new orders should not be created when stock is insufficient.
Process callbacks in this order
Verify the signature and source first, then check the order number, amount and successful state. If they do not match, withhold delivery and record an exception for manual review. Only when they match and the order has not already received a code should you allocate a code, save it to the order and return the acknowledgement required by the payment provider.
If the same notification arrives again and the code has already been delivered, return success without taking another code. A customer not returning to the page does not mean payment failed; query by order number. For queries and missing-order handling, see Payment succeeded but the site has not recorded it。
Enable WeChat and Alipay together without mixing orders
Submit each order to only one channel. After switching channels, continue querying existing orders through their original channel and use the new channel for new orders. See avoiding lost orders when switching channels. Keep real-time settlement separate from digital delivery: delivering a code indicates business fulfillment only. For when funds settle, see real-time settlement。
Confirm integration for your business scenario
Describe your products, order volume, payment methods and settlement needs to confirm the APIs, movement of funds and exception handling item by item.
Contact 稳付pay ↗