Skip to content

Accept your first payment

Create a payment link with one API request, open its URL, pay with a test card, and find the payment in your dashboard. You need a Flint account, curl, and a browser. Flint hosts the checkout page, so there is no checkout UI to build, and no real money moves.

Working from a server or a terminal with no browser for the payment itself? Pay a test order from your server with three curl requests. The test key comes from the dashboard, or from the onboarding API if you have no account yet.

Before you start#

No account yet? Sign up, or run flint signup in your terminal. On a headless machine, run flint signup --credential-store file to save the sandbox key in a file with owner-only permissions. The CLI never prints the key. To keep working in the terminal, use the CLI command in step 1. To use curl, create a key in the dashboard as described next.

Switch the dashboard to your sandbox. In the dashboard, open the environment menu in the top bar. It shows live or sandbox. Choose your sandbox; every account starts with one named Default Test. A test key belongs to the sandbox that is selected when you create it, and the dashboard shows that sandbox's payments only while it is selected.

Get a test API key. On the API keys page:

  1. Click Create key. A sandbox's first key starts as a Restricted key named Test key, with the permissions an integration needs to take payments, including the ones used here. Keep that selection. Full access grants every permission, but asks you to confirm your identity again before the key is created.
  2. Click Create key in the dialog and copy the key. It starts with flint_test_ and is shown once.

If the sandbox already has a key, the dialog starts at Full access instead. Keep it and confirm your identity when asked, or choose Restricted and limit the key to Merchant profile: Read and Payment links: Write. The first check below reads your merchant profile, and step 1 creates the payment link. To also pay from your server, add Orders: Write.

Authentication explains permissions. If your backend provisions merchants, API & agent onboarding creates the account and its first key instead.

Keep the key on your backend. Every request goes to https://api.withflintpay.com with the key in the Authorization header. Test and live keys share that hostname, and the key decides the mode. Replace YOUR_API_KEY in each command with your key.

If you're signed in to the docs, each request below can run against your sandbox with your test key filled in.

Check that your sandbox can take card payments:

cURL
curl https://api.withflintpay.com/v1/merchant \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "data": {
    "merchant_id": "mer_1kmn0aExample",
    "readiness": {
      "payments": { "status": "ready", "next_actions": [] }
    }
  }
}

The response is shortened to the part this check reads.

readiness.payments.status: "ready" means checkout will show a card form. Flint prepares your default sandbox for card payments when you sign up. After sign-up, setup can take a few minutes. While readiness.payments.status_reason is provisioning, wait and run the check again. From the CLI, run flint merchant get --wait-for readiness.payments.status=ready before making your first payment. If a payment returns MERCHANT_NOT_READY with reason provisioning, wait for Retry-After and retry with the same request body and Idempotency-Key.

Warning:

A 200 response confirms the request worked, not that the sandbox can charge cards. While readiness.payments is pending or blocked, the hosted checkout page says "No payment methods are available for this checkout." and asks the buyer to contact the merchant instead of showing a card form. When status_reason is provisioning, Flint is still setting up the sandbox and no onboarding action is needed. For other reasons, status_reason and readiness.requirements name what is still due. Complete it in the dashboard, then run the check again.

Before sharing a checkout URL, review the merchant’s business_name and set the name buyers should see through PATCH /v1/merchant with a live credential, or in the Dashboard. A test key can read the shared profile but cannot update it.

A payment link is a Flint-hosted checkout page with a URL you can share. Create one for a $25 design consultation. Amounts are integers in the currency's minor unit, so 2500 is $25.00. Flint accepts only USD today. See Money & currency for how amounts work.

cURL
curl -X POST https://api.withflintpay.com/v1/payment-links \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: first-payment-link-001" \
  -d '{
    "name": "Design consultation",
    "line_items": [{
      "type": "custom_fixed",
      "name": "Design consultation",
      "quantity": 1,
      "unit_price_money": {"amount": 2500, "currency": "USD"}
    }],
    "tax": {"enabled": false},
    "tip": {"enabled": false}
  }'

name identifies the link in the dashboard's list of payment links. tax.enabled: false and tip.enabled: false keep tax and the tip prompt off this link, so the total stays $25.00 whatever your checkout settings are. The line item is defined on the link itself, so you don't need a product in your catalog first. To sell from your catalog, pass a product's variant_id or a bundle_id instead, as Price each line item describes.

Response
{
  "data": {
    "payment_link_id": "pl_1kmn0aExample",
    "url": "https://checkout.withflintpay.com/pay/pl_1kmn0aExample",
    "status": "active",
    "payment_link_type": "standard",
    "completed_count": 0,
    "line_items": [{
      "payment_link_line_item_id": "plli_1kmn0aExample",
      "key": "line_item_1",
      "name": "Design consultation",
      "quantity": 1,
      "unit_price_money": {"amount": 2500, "currency": "USD"}
    }]
  }
}

The link is active, and nothing has been charged. Copy data.url from your response.

Note: Safe to retry

The request carries an Idempotency-Key. If it times out, send it again with the same key and body, and Flint returns the original link instead of creating a second one. To create another link, change the key, for example from 001 to 002. See Idempotency.

From the CLI#

With the CLI, sign in with flint login or create an account with flint signup. Both save a sandbox credential for later commands. On a headless machine, add --credential-store file to either command. Create the same link and print its URL. These flags leave tax and tips to your checkout settings, which are off for a new account:

Shell
flint payment-links create \
  --name "Design consultation" \
  --item-name "Design consultation" \
  --amount 2500 \
  --currency USD \
  --field url

Step 2: pay with a test card#

Open the URL in a browser. Checkout shows a test-mode banner and a $25.00 total. Fill in the buyer details checkout asks for and pay with:

Test cardAny future expiry, any CVC.

Flint processes card payments on Stripe, so Stripe's test cards work here and you don't need a Stripe account. Cards that decline or require 3D Secure are listed in Testing.

After the payment succeeds, checkout shows a receipt. The link stays active, and every buyer who opens the URL gets their own checkout, so you can pay it again.

Step 3: find the payment in your dashboard#

With the same sandbox selected, open Payments in the dashboard. Your $25.00 payment is at the top of the list with the status Succeeded. Open it for the payment's details, including the order it paid. Each completed checkout on a payment link creates its own order, and the order is listed under Orders.

If you ran the requests from the docs, they used your Default Test sandbox. If the payment isn't listed, check the environment menu: a test payment appears only in the sandbox its key belongs to.

Pay from your server#

You can take the same test payment without a checkout page: create an order, pay it with Stripe's pm_card_visa test token, and read the order back. The key comes from the dashboard, as in Before you start, or from the onboarding API, whose key holds the permissions used here. A key limited to specific permissions needs Orders: Write.

The requests go to the same API host as above, and each one carries an Idempotency-Key. pm_card_visa is a fixed test token that pays any number of orders in a sandbox, so you can run all three requests as often as you like. Change the keys each run, for example from 001 to 002; a repeated key returns the earlier result instead of creating a new order or payment.

Create the order#

The line item is defined on the order, needs no shipping, and has tax turned off, so the total is $25.00.

cURL
curl -X POST https://api.withflintpay.com/v1/orders \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: first-order-001" \
  -d '{
    "line_items": [{
      "type": "custom",
      "name": "Design consultation",
      "quantity": 1,
      "unit_price_money": {"amount": 2500, "currency": "USD"},
      "fulfillment": {"requirement": "none"}
    }],
    "tax": {"enabled": false}
  }'

Copy data.order_id from the response and use it in place of ord_1kmn0aExample in the next two requests and their URLs. The order starts open with payment_status: "unpaid".

Pay the order with a test token#

expected_outstanding_money is the balance you expect to charge. If the order changed since you read it, Flint returns 409 VERSION_CONFLICT instead of charging.

cURL
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/pay \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: first-pay-001" \
  -d '{
  "action": "pay",
  "payment_source": {
    "credential_type": "stripe_payment_method",
    "stripe": {
      "payment_method": "pm_card_visa"
    }
  },
  "expected_outstanding_money": {
    "amount": 2500,
    "currency": "USD"
  }
}'
Response
{
  "data": {
    "order": {
      "order_id": "ord_1kmn0aExample",
      "status": "closed",
      "payment_status": "paid",
      "settlement_amounts": {
        "paid_money": {"amount": 2500, "currency": "USD"},
        "outstanding_money": {"amount": 0, "currency": "USD"}
      }
    },
    "order_payment_attempt": {
      "order_payment_attempt_id": "opat_1kmn0aExample",
      "status": "succeeded",
      "is_resumable": false
    }
  }
}

The response is shortened. Read data.order_payment_attempt.status, not the HTTP status: a declined test token also returns 200, with the attempt failed. Testing lists the tokens for declines and 3D Secure.

Read the order#

cURL
curl https://api.withflintpay.com/v1/orders/ord_1kmn0aExample \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "data": {
    "order_id": "ord_1kmn0aExample",
    "status": "closed",
    "payment_status": "paid",
    "settlement_amounts": {
      "paid_money": {"amount": 2500, "currency": "USD"},
      "refunded_money": {"amount": 0, "currency": "USD"},
      "outstanding_money": {"amount": 0, "currency": "USD"}
    }
  }
}

payment_status: "paid" with outstanding_money.amount at 0 means the payment landed. The order also appears in the dashboard's Orders and Payments pages for this sandbox. In your app, fulfill from the order.paid webhook rather than from the pay response; see Webhooks.

Take it into your app#

  • Share the link as is. One payment link takes payment from any number of buyers. Put the same URL in an email, a QR code, or a pricing page. Payment links covers quantities, donations, events, and subscriptions.
  • Use a checkout session for an order your app builds, such as a cart. Your backend creates the order and a checkout session for it, then sends the buyer to the session's URL. Testing walks through that flow with the same test card, and Payment links vs checkout sessions vs invoices compares the options.
  • Fulfill from the order.paid webhook, not from the browser. A buyer can close the tab before the receipt loads. Subscribe to order.paid, verify the signature, fetch the order, check its dispute_status against the access rules, and fulfill. Orders from a link carry origin: "payment_link" and the link's metadata. Flint retries a delivery until your endpoint acknowledges it, so make fulfillment safe to repeat. See Webhooks and Fulfill and reconcile.
  • Live mode is the same request with a live key. Same hostname, same body. Going live covers account verification and the cutover.

Next steps#

  • Payment links: reusable links for products, donations, events, and subscriptions, and how to track what each link sold.
  • Checkout sessions: one hosted checkout for one order, with buyer details, payment options, expiration, and appearance.
  • Testing: declines, 3D Secure, refunds, and webhook deliveries in your sandbox.
  • Accept a payment with Next.js: create the order and checkout session from a Next.js or Express server and grant access from the order.paid webhook.
  • Embedded payments with Stripe Elements: collect the card in your own UI instead of on a hosted page.
  • SDKs and CLI: call the same API from @flintpay/node, flintpay/flint, or your terminal.
  • Error handling: read a failed response and decide whether to retry.

Was this helpful?