PayLynks

Quickstart

Take a test payment in about five minutes: get keys, create a payment intent on your server, and show the PayLynks checkout in the browser.

1. Get test keys

The fastest way is the CLI, run in your app's folder:

npx paylynks init

It opens your browser to approve, writes PAYLYNKS_SECRET_KEY to .env.local, and adds a checkout route, component and webhook receiver to Next.js apps. You can also create keys in the dashboard under Developers.

  • sk_test_… — secret key. Server only. Creates payments, refunds, invoices.
  • pk_test_… — publishable key. Safe in the browser, but you rarely need it: the embedded checkout only needs a payment's client_secret.

Test mode never moves real money.

2. Create a payment intent on your server

Amounts are integer cents. Decide the price on the server, never from what the browser sends.

curl -X POST https://paylynks.io/api/v1/payment_intents \
  -H "Authorization: Bearer $PAYLYNKS_SECRET_KEY" \
  -H "Idempotency-Key: order-1042" \
  -H "Content-Type: application/json" \
  -d '{"amount": 2500, "description": "Order 1042"}'

The response includes client_secret (pi_…_secret_…). Send only that to the browser.

3. Show checkout

<script src="https://paylynks.io/js/v1.js"></script>
<div id="checkout"></div>
<script>
  PayLynks().mountCheckout("#checkout", {
    clientSecret: "pi_..._secret_...",
    onSuccess: (e) => location.assign("/thanks?pi=" + e.payment_intent),
  });
</script>

Card fields load inside a PayLynks iframe and go straight to the payment gateway, so card numbers never touch your page or server. If the merchant surcharges credit cards, checkout shows the disclosure and the final total before the payer confirms.

4. Pay with a test card

Use 4242 4242 4242 4242, any future expiry, any CVC and ZIP. See Testing for debit and decline cards.

5. Get notified

Register a webhook endpoint and fulfil orders on payment_intent.succeeded. See Webhooks.

No code?

Create a payment link in the dashboard and share the URL or drop in the pay button.

View as markdown