lollipayDocs

Quickstart

Create a test checkout session, pay it with a test card and confirm it, all from your terminal.

You'll need a Lollipay account that has finished onboarding. Everything here runs in test mode, so nothing is charged.

Create a test key

Open Dashboard → Developers → API keys and choose Create API key. Keep the defaults: Test, Bearer and the Checkouts permissions. Copy the secret when it's shown; you won't see it again.

Terminal
export LOLLIPAY_SECRET_KEY="lp_test_sk_…"
export LOLLIPAY_STORE_ID="your-store-id"

The store ID is at the top of the same page.

Create a checkout session

Terminal
curl https://api.lollipay.cc/v1/stores/$LOLLIPAY_STORE_ID/checkouts \
  -H "Authorization: Bearer $LOLLIPAY_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [{ "name": "Pro plan", "amount": 4900 }],
    "return_url": "https://example.com/thanks"
  }'

The response holds the session. Note its id and checkout_url:

201 Created
{
  "ok": true,
  "data": {
    "id": "cs_55ca30f7581d9a76ac7188349f33b4811c4b43f28935ed507586d3bd92fa4982",
    "object": "checkout_session",
    "livemode": false,
    "status": "open",
    "checkout_url": "https://checkout.lollipay.cc/invoice/cs_55ca30f7581d9a76ac7188349f33b4811c4b43f28935ed507586d3bd92fa4982",
    "currency": "USD",
    "total_amount": 4900,
    "expires_at": 1792336800
  }
}

Pay it with a test card

Open checkout_url in a browser. Pay with 4242 4242 4242 4242, any future expiry and any CVC. The page confirms the payment and sends you to https://example.com/thanks?checkout_id=cs_….

Confirm the payment

On your return_url page, your server retrieves the session before fulfilling the order:

Terminal
curl https://api.lollipay.cc/v1/stores/$LOLLIPAY_STORE_ID/checkouts/cs_55ca30f7581d9a76ac7188349f33b4811c4b43f28935ed507586d3bd92fa4982 \
  -H "Authorization: Bearer $LOLLIPAY_SECRET_KEY"

"status": "complete" and a payment_id mean it's paid. The payment also shows in the dashboard in test mode.

Next steps

On this page