Payment Links
API ReferencePayment LinksCreate a Payment from a Link
Create a Payment from a Link
Create the payment for a single checkout against an existing payment link and get a client_secret to initialize the SDK.
POST /payment_link/{payment_link_id}/create-payment
Use this when folding payment links into your own checkout. One-time links return the link's payment; reusable links (recurring, donation, or any link with a usage_limit) mint a fresh payment on every checkout. If the link has expired or reached its usage limit, the response returns expired: true with no client_secret.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
payment_link_id | string | Yes | The id of the payment link to create a payment for. |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | integer | No | Amount in the smallest currency unit. Required when the link has no fixed amount (variable or donation links); ignored when the link defines a fixed amount. |
payment_id | string | No | Resume an existing payment for this link instead of creating a new one (retry). |
customer_name | string | No | Customer name to attach to the payment. |
customer_email | string | No | Customer email to attach to the payment. |
return_url | string | No | URL to redirect the customer to after they complete this payment. Sent per order; when omitted, the business profile return_url is used. |
order_details | array | No | Order or cart line items to attach to the payment. |
metadata | object | No | Structured metadata to attach to the payment. |
merchant_order_reference_id | string | No | Your own order reference, stored on the payment for reconciliation. |
billing | object | No | Billing details to attach to and retain on the payment. |
shipping | object | No | Shipping details to attach to the payment. |
Request Example
curl -X POST 'https://api.rpayz.com/payment_link/plink_1234567890/create-payment' \ -H "Content-Type: application/json" \ -H "api-key: snd_YOUR_API_KEY" \ -d '{ "amount": 6540, "return_url": "https://example.com/orders/1234/return", "merchant_order_reference_id": "order_1234", "customer_email": "customer@example.com", "billing": { "address": { "first_name": "Jane", "last_name": "Doe", "line1": "1467 Harrison Street", "city": "San Francisco", "state": "CA", "zip": "94122", "country": "US" } }, "order_details": [ { "product_name": "T-shirt", "quantity": 1, "amount": 6540 } ]}'Response
{
"client_secret": "pay_1234567890_secret_abc123",
"expired": false
}Pass the client_secret to the SDK to render the payment form and complete the payment.
Next steps
- Create Payment Link — create the link this payment is made against.