Using an LLM or Agent to Build a Payments POC
This page helps you quickly build a proof of concept (POC) integration using an LLM, coding agent, or IDE assistant. The fastest POC is:
Create a payment using
POST /PaymentsPresent the hosted payment page URL (
paymentUrls[0]) in a browser tab or iframePoll status using
GET /Payments/{paymentId}/trackinguntil the payment reaches an outcome
This approach avoids webhook setup and is ideal for demos and early prototypes.
POST /Payments/cryptois deprecated but still supported, and takes the same request body. UsePOST /Paymentsfor new work.
What you need
To run the POC, you need these values from Bead:
apiKey(terminal API key)merchantIdterminalId
Sandbox defaults:
Payments base URL:
https://api.test.devs.beadpay.ioPayments authentication header:
X-Api-Key: <apiKey>There is no separate authentication URL for Payments when using API key authentication.
POC flow
Step 1: Create a hosted payment page
Endpoint:
POST /Payments
Required headers:
X-Api-Key: {apiKey}Content-Type: application/json
Minimal request body (recommended for POCs). refundEmail and customer are required on virtual terminals:
Save these values from the response:
paymentUrls[0](hosted payment page URL)paymentId(used to check status)
Step 2: Present the hosted payment page
You can present the hosted payment page in one of these ways:
Option A: Open in a browser tab
Redirect or open
paymentUrls[0]directly in the user’s browser
Option B: Embed in an iframe (web apps)
Render an iframe with
src=paymentUrls[0]Use a full height container so QR codes and tender selection are visible
If embedding is blocked, fall back to opening in a new tab
Step 3: Poll for status using paymentId
Endpoint:
GET /Payments/{paymentId}/tracking
Headers:
X-Api-Key: {apiKey}Accept: application/json
Example curl (Sandbox):
Recommended polling behavior:
Start polling after you launch the hosted page
Poll every 2 seconds for a POC demo
Only log or display changes when status changes
Stop polling when
statusCodeis no longercreatedorprocessing. The outcomes are:Paid:
completed,overpaidNot paid:
underpaid,expired,cancelled,invalid,abandoned
For overpaid, the payment is paid and the excess is returned to the payer later through Bead's reclaim process. For underpaid, the payment is not paid and the customer should start a new payment. See Payment Statuses.
POC UI flow (recommended)
Build a single page with three states:
Amount entry
Amount input that accepts decimals
Primary button: Pay with crypto
In progress
Show the hosted payment page (iframe or new tab link)
Show live status (
statusCode) while polling
Complete
Show a completion view when an outcome is reached
Display:
the
statusCodeand whether the payment is paidrequested amount
paymentId
Button: Start a new payment (resets to amount entry)
Common troubleshooting
401 Unauthorized
API key missing or invalid
Header must be exactly
X-Api-KeyEnsure you are using the real
apiKeyvalue, not a masked value
403 Forbidden
API key is valid but not permitted for the
merchantIdorterminalIdConfirm all values are from the same environment and credential set
Environment mismatch
Sandbox values only work with the Sandbox base URL
Production values only work with the Production base URL
Copy and paste prompt for an LLM or coding agent
Use the prompt below in ChatGPT, an IDE agent, or another coding assistant. It produces a minimal POC that creates a payment, presents the hosted page, polls for status, and shows a completion screen.
If your agent cannot open the OpenAPI URL in the prompt directly, download the spec yourself and attach the file to the conversation.
Prompt
You are a senior full stack engineer. Build a minimal proof of concept that integrates with Bead Payments using API key authentication only.
Sandbox defaults:
Payments base URL:
https://api.test.devs.beadpay.ioPayments auth header:
X-Api-Key: {apiKey}No separate authentication URL is used for Payments when using API key authentication.
References (use if you need to confirm schemas and endpoints):
OpenAPI (authoritative):
https://api.test.devs.beadpay.io/openapi/v1.jsonDeveloper docs (supporting):
https://developers.bead.xyz/If there is any conflict, follow the OpenAPI. For Payments authentication, do not use OAuth. UseX-Api-Keyonly.Inputs I will provide:
{apiKey}(terminal API key, full value)
{merchantId}
{terminalId}UI requirements:
Show a simple amount entry input:
Label: Amount
Accept decimals
Validate amount is greater than 0
Default to 1.00 on first load
Show a primary button:
Label: Pay with crypto
When the user clicks Pay with crypto:
Call the backend to create a payment with the entered amount
Display the hosted payment page in an iframe (or open a new tab if iframe embedding is blocked)
Display a status panel showing the current
statusCodeWhen the payment reaches an outcome, show a Payment Complete screen:
Replace the iframe view with a completion view
Display the status and whether the payment is paid. Paid:
completed,overpaid. Not paid:underpaid,expired,cancelled,invalid,abandonedFor
overpaid, show that the extra amount will be returned to the payerFor
underpaid, show that the payment did not go through and offer to start a new paymentDisplay the amount requested
Display the paymentId
Provide a button to Start a new payment (resets UI back to amount entry)
API requirements:
Create a hosted payment using:
POST https://api.test.devs.beadpay.io/PaymentsHeader:
X-Api-Key: {apiKey}Header:
Content-Type: application/jsonJSON body includes:
merchantId: {merchantId}
terminalId: {terminalId}
requestedAmount: <amount from UI>
reference: "POC-ORDER-<unique>"
refundEmail: "test@example.com"
customerobject exactly as shown belowUse this customer object in the request body:
firstName: "Test"
lastName: "User"
email: "test@example.com"
address: "123 Main St"
address2: ""
city: "Boston"
state: "MA"
postalCode: "02110"
countryCode: "US"From the create payment response, extract:
paymentUrls[0]aspaymentUrl
paymentIdPoll for status using:
GET https://api.test.devs.beadpay.io/Payments/{paymentId}/trackingHeader:
X-Api-Key: {apiKey}Poll every 2 seconds
Only log when status changes
Stop polling when
statusCodeis no longercreatedorprocessingDeliverables:
One backend endpoint (or function/route) that:
accepts
requestedAmountcalls
POST /Paymentsreturns
paymentUrl,paymentId, and echoedrequestedAmountOne backend endpoint (or function/route) that:
accepts
paymentIdcalls
GET /Payments/{paymentId}/trackingreturns the status JSON including
statusCodeOne UI page with three states:
Amount Entry state (input + Pay with crypto button)
In Progress state (iframe or new tab link + live status panel)
Payment Complete state (status + paid or not paid + paymentId + start over button)
Constraints:
Use only API key auth for Payments (
X-Api-Key). Do not include OAuth flows, tokens, or any authentication URL.Do not include webhooks.
Do not include onboarding or entity management.
Treat
apiKeyas a secret and do not log it.Keep the implementation small and readable.
Last updated