Quickstart
Get started with the Uprails API and process your first payment.
Prerequisites
Before you begin, make sure you have:
- An Uprails account (sign up at the dashboard)
- Your API keys from the dashboard
1
Get Your API Keys
Navigate to your Uprails dashboard and find your API keys. You'll need:
| Key Type | Prefix | Use |
|---|---|---|
| Sandbox Secret Key | snd_ | For development and testing |
| Production Secret Key | prd_ | For production (real transactions) |
| Sandbox Publishable Key | pk_snd_ | For client-side token creation (testing) |
| Production Publishable Key | pk_prd_ | For client-side token creation (production) |
Keep Keys Secure
Never expose your secret keys in client-side code or version control. Use environment variables to store them securely.
2
Make Your First API Call
Test your connection by making a simple request to the API:
Test Connectionbash
curl https://api.uprails.com/health \
-H "api-key: snd_YOUR_API_KEY"You should receive a 200 OK response confirming your API key is valid.
3
Create Your First Payment
Now let's process a test payment. Use the test card number 4242424242424242 which always succeeds:
Create Payment
curl -X POST https://api.uprails.com/payments \
-H "Content-Type: application/json" \
-H "api-key: snd_YOUR_API_KEY" \
-d '{
"amount": 1000,
"currency": "USD",
"profile_id": "YOUR_PROFILE_ID",
"confirm": true,
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "12",
"card_exp_year": "2025",
"card_cvc": "123"
}
}
}'4
Handle the Response
A successful payment returns the payment object with its current status:
Success Responsejson
{
"payment_id": "pay_1234567890abcdef",
"merchant_id": "mer_xyz789",
"status": "succeeded",
"amount": 1000,
"amount_received": 1000,
"currency": "USD",
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "4242",
"brand": "visa",
"exp_month": "12",
"exp_year": "2025"
}
},
"created": "2024-01-15T10:30:00Z"
}Check the status field to determine the payment outcome:
succeeded- Payment was successfulrequires_action- Additional authentication needed (3DS)failed- Payment failed (check error details)
Test Cards
Use these test card numbers in sandbox mode:
| Card Number | Behavior |
|---|---|
| 4242424242424242 | Always succeeds |
| 4000002500003155 | Requires 3DS authentication |
| 4000000000009995 | Always fails (insufficient funds) |
| 4000000000000002 | Card declined |
Use any valid future expiry date and any 3-digit CVC for test cards.