Flow overview
Step 1 — Store the order before payment
Before creating the LigdiCash invoice, persist the order in your database with statuspending. You’ll need its identifier to track the payment.
Step 2 — Create the invoice on the backend
Your backend calls the create-invoice endpoint and stores the returnedtoken.
response_code: "00"):
token in your database linked to the order. You’ll need it to verify the payment.
Step 3 — Redirect the customer to the payment page
Returnresponse_text (the payment URL) to your frontend, then redirect the customer.
Frontend (JavaScript)
return_url (success) or cancel_url (cancellation).
Step 4 — Handle the callback
LigdiCash sends a POST notification to yourcallback_url whenever the transaction status changes. Your backend must:
- Identify the order via
custom_data - Re-verify the status using the
confirmendpoint (never trust the payload alone) - Update the order in the database
- Reply
200 OK
Node.js (Express)
LigdiCash sends two POST requests to your callback for every event: one as
application/x-www-form-urlencoded and one as application/json. Handle them idempotently. See Callback idempotency.Step 5 — Verify the status on the frontend
After the redirect to yourreturn_url, the frontend asks your backend for the final result to display. The return_url is a UI signal — it does not prove the payment succeeded.
Frontend — return_url page
Backend — GET /api/orders/:id/status
Recap
Create the invoice
Backend → POST
/pay/v01/redirect/checkout-invoice/create. Store the returned token.Confirm the order
Update the status in your database and trigger delivery if
status === "completed".Related pages
- Create an invoice — full endpoint parameters
- Callback security — detailed re-verification pattern
- Parse custom_data — the 3 possible shapes
- Recommended architecture — full backend structure
