Skip to main content

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

ParameterTypeRequiredDescription
slugstringYesPayment 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

ParameterTypeRequiredDescription
slugstringYesPayment link slug

Headers

HeaderTypeRequiredDescription
OriginstringNoFrontend origin (used for return URL)
RefererstringNoAlternative 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

ParameterTypeRequiredDescription
slugstringYesPayment link slug

Response

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "canceled",
"updatedAt": "2024-01-01T12:00:00.000Z"
}

Use Cases

  1. Get pay – Call GET /pay/:slug to show amount, token, and network on your page.
  2. Start payment – Call POST /pay/:slug/confirm and redirect the user to the returned URL.
  3. Cancel – Call POST /pay/:slug/cancel if the user abandons or you need to cancel the intent.

Status Codes

Status CodeDescription
200Success
400Bad Request
404Not Found (invalid slug)
500Internal Server Error

See Also