--- title: Payment Callback and Order Status Inquiry Implementation Guide permalink: /en/notes/onlinePayment/bestPractices/fetchStatus/ createTime: '2025/03/07 16:01:49' description: 'Learn how to combine payment notifications and transaction inquiry to get the final order status.' --- ## Background PingPongCheckout V4 provides two ways to synchronize the state between merchant server and PingPongCheckout server: 1. Asynchronous Notification 2. Transaction Query If relying solely on asynchronous notifications, due to network exceptions or system fluctuations, it may cause situations where user payments succeed but merchants fail to successfully receive payment result notifications, resulting in displaying orders as unpaid. Untimely updates of order status on the merchant side can easily lead to customer complaints. ## Solution ```mermaid %%{init: { 'theme': 'base', 'themeVariables': { 'primaryColor': '#2196F3', 'primaryTextColor': '#FFFFFF', 'primaryBorderColor': '#1976D2', 'lineColor': '#1565C0', 'secondaryColor': '#E3F2FD', 'tertiaryColor': '#BBDEFB', 'background': '#F8FBFF', 'mainBkg': '#E3F2FD', 'nodeBorder': '#1976D2', 'clusterBkg': '#F5F5F5', 'clusterBorder': '#1976D2', 'titleColor': '#0D47A1' } }}%% flowchart TB subgraph AutoCapture["📦 Automatic Capture (captureDelayHours=0)"] direction TB A1([🚀 Create Order]) --> A2[INIT
Initialize] A2 -->|Payment Request| A3[PROCESSING
Processing] A3 -->|Transaction Failed| A4[FAILED
Payment Failed] A3 -->|Transaction Success| A5[SUCCESS
Payment Success] A3 -->|Timeout Close| A6[CLOSED
Order Closed] A2 -->|Timeout Close| A6 end subgraph ManualCapture["🔧 Manual Capture (captureDelayHours=-1)"] direction TB B1([🚀 Create Order]) --> B2[INIT
Initialize] B2 -->|Payment Request| B3[PROCESSING
Processing] B3 -->|Auth Success| B4{Auth
Success?} B4 -->|Yes| B5[AUTH_SUCCESS
Pre-auth Success] B4 -->|No| B6[FAILED
Payment Failed] B5 -->|Request VOID| B7[CANCEL
Pre-auth Cancelled] B5 -->|Capture| B8{Capture} B8 -->|Capture Success| B9[SUCCESS
Payment Success] B8 -->|Capture Failed| B10[Capture Failed] B10 -->|Request Refund
Cannot Request| B11[Refund Success/Failed
Transaction Cannot Recover] B2 -->|Timeout Close| B12[CLOSED
Order Closed] end style A1 fill:#2196F3,stroke:#1976D2,color:#FFFFFF style A5 fill:#4CAF50,stroke:#388E3C,color:#FFFFFF style A4 fill:#F44336,stroke:#D32F2F,color:#FFFFFF style A6 fill:#9E9E9E,stroke:#757575,color:#FFFFFF style B1 fill:#2196F3,stroke:#1976D2,color:#FFFFFF style B5 fill:#4CAF50,stroke:#388E3C,color:#FFFFFF style B9 fill:#4CAF50,stroke:#388E3C,color:#FFFFFF style B6 fill:#F44336,stroke:#D32F2F,color:#FFFFFF style B7 fill:#FF9800,stroke:#F57C00,color:#FFFFFF style B12 fill:#9E9E9E,stroke:#757575,color:#FFFFFF ``` 1. Merchant frontend page redirects to payResultUrl page, merchant needs to call merchant order inquiry API to confirm order status, and display query results to user. 2. Merchant backend needs to accurately and efficiently process asynchronous payment result notifications sent by PingPongCheckout V4, and return processing results according to interface specifications. 3. When merchant backend does not receive asynchronous payment result notification, merchant should proactively call Transaction Query to synchronize order status. ::: note Note The above solution best fits the checkout integration method. If integrating in Non-hosted mode, you can directly obtain order status from the synchronous return result of Place Order and Pay. If the obtained result is not a final state, you can execute according to the above process. ::: ## Order Closure Initiated by PingPongCheckout For orders where users have not paid for an extended period, PingPongCheckout V4 will perform order closure processing. After closing the order, users cannot continue to make payments, and merchants can obtain the `CLOSED` status through query interfaces or asynchronous notifications. ::: note Note If a custom order closure notification address `closeNotificationUrl` was provided, an order closure notification will be sent when the order reaches the `CLOSED` status. :::