This document provides a comprehensive guide to integrating with the Lesspay Pay In (Collection) API.1. Integration Flow#
The typical Pay In integration involves the following interaction between the Merchant, the User, and Lesspay.Sequence Diagram#
2. Order State Logic#
Understanding the order lifecycle is crucial for handling transactions correctly.3. Integration Steps#
Step 1: Create Order#
Call the /api/global/v1/pay/create-order endpoint.Request: Ensure request_id is unique. Pass the correct currency and amount (as string).
Response: You will receive a checkout_url.
Step 2: Redirect User#
Redirect the user's browser to the checkout_url received in Step 1. This page handles the payment interface (Cashier mode) or interaction with the upstream channel.Step 3: Handle Notification (Webhook)#
Lesspay will notify your notify_url when the order status changes (e.g., to SUCCEED or FAILED).Validation: Verify the signature in the header.
Logic: Update your system's order status.
Response: Return the string "SUCCESS" to acknowledge receipt.
Step 4: Query Status (Optional but Recommended)#
For robustness, implement a scheduled task to verify order status using /api/global/v1/pay/query-order, specifically for orders that stay in PENDING states for too long.
Modified at 2025-12-19 03:48:55