Uprails
Payments/Create

Create Payment

Create a payment resource to start a checkout process.

POSThttps://api.uprails.com/payments

Creates a payment resource, which represents a customer’s intent to pay. This endpoint is the starting point for various payment flows.

Body Parameters

amountintegerrequired

The primary amount for the payment, provided in the lowest denomination of the specified currency (e.g., 6540 for $65.40 USD).

currencystringrequired

The three-letter ISO 4217 currency code (e.g., "USD", "EUR") for the payment amount.

profile_idstringrequired

The identifier for the business profile associated with this payment.

payment_idstring

A unique identifier for the payment. If not provided, Uprails will generate one.

confirmboolean

If set to true, Uprails attempts to confirm and authorize the payment immediately after creation.

customer_idstring

The identifier for the customer.

descriptionstring

An arbitrary string attached to the payment.

return_urlstring

The URL to redirect the customer to after they complete the payment process.

payment_method_dataobject

The payment method information provided for making a payment.

cardobject

Card details

card_numberstringrequired

Card number

card_exp_monthstringrequired

Expiry month

card_exp_yearstringrequired

Expiry year

card_cvcstringrequired

CVC code

card_holder_namestring

Card holder name

metadataobject

Set of key-value pairs for storing additional information.

Request Example

Create Payment
curl -X POST https://api.uprails.com/payments \
  -H "Content-Type: application/json" \
  -H "api-key: snd_YOUR_API_KEY" \
  -d '{
    "amount": 6540,
    "currency": "USD",
    "profile_id": "YOUR_PROFILE_ID",
    "description": "Premium subscription"
  }'

Response

200OK
{
  "payment_id": "pay_mbabizu24mvu3mela5njyhpit4",
  "status": "requires_payment_method",
  "amount": 6540,
  "currency": "USD",
  "client_secret": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo",
  "created": "2024-01-22T10:11:12Z",
  "customer_id": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
  "profile_id": "pro_xxxxx",
  "description": "It's my first payment request",
  "metadata": {}
}