Create Payment
Create a payment resource to start a checkout process.
https://api.uprails.com/paymentsCreates a payment resource, which represents a customer’s intent to pay. This endpoint is the starting point for various payment flows.
Body Parameters
amountintegerrequiredThe primary amount for the payment, provided in the lowest denomination of the specified currency (e.g., 6540 for $65.40 USD).
currencystringrequiredThe three-letter ISO 4217 currency code (e.g., "USD", "EUR") for the payment amount.
profile_idstringrequiredThe identifier for the business profile associated with this payment.
payment_idstringA unique identifier for the payment. If not provided, Uprails will generate one.
confirmbooleanIf set to true, Uprails attempts to confirm and authorize the payment immediately after creation.
customer_idstringThe identifier for the customer.
descriptionstringAn arbitrary string attached to the payment.
return_urlstringThe URL to redirect the customer to after they complete the payment process.
payment_method_dataobjectThe payment method information provided for making a payment.
cardobjectCard details
card_numberstringrequiredCard number
card_exp_monthstringrequiredExpiry month
card_exp_yearstringrequiredExpiry year
card_cvcstringrequiredCVC code
card_holder_namestringCard holder name
metadataobjectSet of key-value pairs for storing additional information.
Request Example
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
{
"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": {}
}