LLedgerline DocsAPI v2.4Want docs like this? Talk to Doc Foundry

Get started / Quickstart

Quickstart

Create a sandbox payment, complete it with a test card and confirm it succeeded. You need a terminal and about ten minutes.

Before you start

1. Set your key

Save the key as an environment variable so it stays out of your shell history and your code.

Terminalbash
export LEDGERLINE_KEY=sk_test_4f9a...

2. Create a payment

This creates a payment of ₦2,500.00 (250000 kobo) and returns a hosted checkout link.

Requestcurl
curl https://sandbox.ledgerline.example/v2/payments \
  -H "Authorization: Bearer $LEDGERLINE_KEY" \
  -H "Idempotency-Key: 6c1f6a0e-2f7b-4b51-9a7e-0d3c2b7e9f10" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 250000,
    "currency": "NGN",
    "reference": "order_1042",
    "customer": { "email": "ada@example.com" },
    "redirect_url": "https://yourshop.example/thanks"
  }'
Response · 201 CreatedJSON
{
  "id": "pay_7Hq2LmX9",
  "status": "pending",
  "amount": 250000,
  "currency": "NGN",
  "reference": "order_1042",
  "checkout_url": "https://checkout.sandbox.ledgerline.example/pay_7Hq2LmX9",
  "created_at": "2026-11-03T10:14:22Z"
}

3. Pay with a test card

Open the checkout_url and pay with one of these test cards. Use any future expiry date and any three-digit CVV.

Card numberResult
5060 9900 0000 0001Succeeds
5060 9900 0000 0019Declined: insufficient funds
5060 9900 0000 0027Asks for a one-time password. Enter 123456.

4. Confirm the result

Retrieve the payment to check its status. In production, rely on webhooks instead of polling.

Requestcurl
curl https://sandbox.ledgerline.example/v2/payments/pay_7Hq2LmX9 \
  -H "Authorization: Bearer $LEDGERLINE_KEY"

The status is now succeeded. That's it: you've taken your first payment.

Never fulfil an order from the redirect alone

Customers can close the tab or edit the redirect URL. Mark an order as paid only after you've confirmed the status from the API or a verified webhook.

Next steps

Last updated 3 November 2026