Pay API Reference
Complete reference for the Pay API endpoints. Use these endpoints when you have a payment link slug and want to get pay details, confirm, or cancel.
Base URL
https://api.orcarail.com/api/v1
Get Pay by Slug
Get pay details for a payment link by its slug. No authentication required; use this to display pay info before the customer pays.
GET /pay/:slug
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Payment link slug (e.g., pl_abc123) |
Response
Returns pay details including amount, token, network, and any metadata needed to render the pay page.
{
"id": 1,
"title": "Payment for services",
"slug": "pl_abc123",
"amount": "0.1",
"tokenId": 1,
"networkId": 1,
"status": "active",
"expiresAt": "2024-12-31T23:59:59.000Z",
"metadata": {},
"createdAt": "2024-01-01T00:00:00.000Z"
}
Confirm Pay
Confirm a payment intent by slug and get the redirect URL to the hosted pay app. The request may use an Origin or Referer header to set the frontend origin for the return URL.
POST /pay/:slug/confirm
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Payment link slug |
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Origin | string | No | Frontend origin (used for return URL) |
Referer | string | No | Alternative to Origin for frontend origin |
Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "requires_confirmation",
"nextAction": {
"type": "redirect_to_url",
"redirectToUrl": {
"url": "https://pay.orcarail.com/pay/pl_abc123?payment_intent=550e8400-e29b-41d4-a716-446655440000&payment_intent_client_secret=550e8400-e29b-41d4-a716-446655440000_secret_abc123"
}
}
}
Redirect the customer to nextAction.redirectToUrl.url to complete payment on the hosted pay page.
Cancel Pay
Cancel the payment intent associated with a payment link slug.
POST /pay/:slug/cancel
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Payment link slug |
Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "canceled",
"updatedAt": "2024-01-01T12:00:00.000Z"
}
Use Cases
- Get pay – Call
GET /pay/:slugto show amount, token, and network on your page. - Start payment – Call
POST /pay/:slug/confirmand redirect the user to the returned URL. - Cancel – Call
POST /pay/:slug/cancelif the user abandons or you need to cancel the intent.
Status Codes
| Status Code | Description |
|---|---|
200 | Success |
400 | Bad Request |
404 | Not Found (invalid slug) |
500 | Internal Server Error |
See Also
- Payment Intents - Create and manage payment intents by ID
- Payments - Payment links and transactions
- Webhooks - Receive payment events