Cursor ≥ 0.45: create .cursor/rules/ligdicash.mdc at the root
Older versions: create .cursorrules at the root
Add the following content:
# LigdiCash integration## ContextLigdiCash is a mobile money payment aggregator in West Africa.API base URL: https://app.ligdicash.com## Mandatory headers on every request```Apikey: {API_KEY}Authorization: Bearer {AUTH_TOKEN}Accept: application/jsonContent-Type: application/json```## Data format- Phone numbers: E.164 format without `+` or spaces — e.g. `22670000000`- Amounts: integers (CFA francs have no sub-unit) — e.g. `5000`- Currency: `XOF` exclusively- API keys in examples: always `{API_KEY}` and `{AUTH_TOKEN}`, never real values## Golden rule — transaction identificationThe `token` returned at creation is different from the `token` received in the callback.Never use that token to identify a transaction.Always pass a merchant identifier in `custom_data` at creation:```json"custom_data": { "transaction_id": "ORD-2025-00042" }```In the callback, `custom_data` comes back as an array of objects. LigdiCash adds its own fields (`hash`, `logfile`). Extract with:```javascriptconst entry = custom_data.find(e => e.keyof_customdata === "transaction_id");const transactionId = entry?.valueof_customdata;```## Hosted payin — pitfalls- `customer` must stay `""` — otherwise LigdiCash filters the visible operators- Never open the payment URL in an `<iframe>` — use the same tab, a new tab, a popup, or a native WebView## Callback- LigdiCash sends two POSTs: one `application/x-www-form-urlencoded` + one `application/json`. Deduplicate.- Re-verify each callback by calling the `confirm` endpoint with the token stored at creation. Never trust the received payload.
Use these prompts in the Cursor chat (Cmd+L or Ctrl+L).
Hosted payin (checkout-invoice)
Implement a LigdiCash hosted payin in [language].- Endpoint: POST https://app.ligdicash.com/pay/v01/redirect/checkout-invoice/create- Amount: variable (function parameter)- customer must stay "" (empty)- Pass transaction_id in custom_data (object): { "transaction_id": "..." }- Open the returned URL in a new tab (no iframe)- Handle HTTP errors and response_code != "00"Return the payment URL or throw an exception.
Secure callback handler
Write a LigdiCash callback handler in [language/framework].Required behavior:1. Accept POST in application/json AND application/x-www-form-urlencoded2. Deduplicate by token (idempotency)3. Re-verify the status by calling the confirm endpoint with the token stored in the database4. custom_data in the callback is an array of objects — extract via keyof_customdata === "transaction_id"5. Update the order in the database only if the confirm status is "00"
Payout to mobile money
Implement a direct LigdiCash payout to mobile money in [language].- Endpoint: POST https://app.ligdicash.com/pay/v01/straight/payout- Parameters: amount, phone number (22670XXXXXXX format), description- Pass transaction_id in custom_data (object): { "transaction_id": "..." }- Handle errors and log the wiki URL on failure
Enable Codebase indexing in Cursor’s settings so it analyzes your existing files and generates code that matches your architecture.