⚑ SwiftPayHub API

The easiest way to accept payments via UPI

πŸ”— Base URL: https://swiftpayhub.xyz/payment/api/v1/index.php?path=
1

πŸ”‘ Get Your API Credentials

First, you need an API Key and API Secret. These are your identity for all API requests.

πŸ“‹ How to Get Them:
1. Log in to your Admin Panel.
2. Click on API in the sidebar.
3. Select your merchant and click "Generate Key".
4. Copy both values immediately – the secret is shown only once!
⚠️ Keep your secret safe. Never share it or commit it to code repositories.
// Example credentials (replace with yours) API-Key: SPH_9B1FEB995666C04FBE4D2774AE API-Secret: a71cfd7d9fdcad46a887e757a0d377aabe28f19ac904868153351eb18e1f9ac3
2

πŸ” Authenticate Every Request

All API calls must include your credentials in the request headers.

// Required headers API-Key: YOUR_API_KEY API-Secret: YOUR_SECRET Content-Type: application/json

Test your credentials: Try the balance endpoint.

# Check wallet balance curl -X GET \ "https://swiftpayhub.xyz/payment/api/v1/index.php?path=merchant/balance" \ -H "API-Key: YOUR_API_KEY" \ -H "API-Secret: YOUR_SECRET"
βœ… Success response (HTTP 200):
{ "status": "success", "data": { "balance": 1500.00, "currency": "INR" } }
3

πŸ’° Create a Payment Link Essential

Generate a payment link that you can share with your customers.

# Create a payment curl -X POST \ "https://swiftpayhub.xyz/payment/api/v1/index.php?path=payments/create" \ -H "API-Key: YOUR_API_KEY" \ -H "API-Secret: YOUR_SECRET" \ -H "Content-Type: application/json" \ -d '{ "amount": 100.00, "currency": "INR", "description": "Product Purchase", "customer_email": "john@example.com" }'
βœ… Success response:
{ "status": "success", "data": { "payment_link": "https://swiftpayhub.xyz/payment/pay.php?code=PAY202608081000001234" } }

➑️ Next step: Redirect your customer to the payment_link.

4

πŸ”” Receive Real‑time Updates (Webhooks)

Register a webhook URL to be notified when payment events occur.

# Register a webhook curl -X POST \ "https://swiftpayhub.xyz/payment/api/v1/index.php?path=webhooks/register" \ -H "API-Key: YOUR_API_KEY" \ -H "API-Secret: YOUR_SECRET" \ -H "Content-Type: application/json" \ -d '{ "url": "https://yourapp.com/webhook", "events": ["payment.success", "payment.failed"] }'