Routing-only
You keep your own payment gateway accounts and execute collections yourself. SwcPay only decides which gateway and MID to use for each transaction.
https://api-collections.swcindia.online
What you get
| Service | What it does |
|---|---|
| Intelligent routing | Picks a live MID + gateway from the MIDs SwcPay configured for you. |
| Distribution | Splits volume using share % (must total 100%). |
| Health & circuits | Avoids gateways that are failing, over TPS, or below the SR floor. |
| Daily limits | Calendar day Asia/Kolkata. |
| Abuse filters | Same-user MID repeats, same-amount cooldown, anti-concentration. |
| Failover | Re-decide with excludedGateways if your PSP call never left. |
| Outcome learning | Report SUCCESS / FAILED / TIMEOUT after you collect. |
| No KYC | Routing-only skips KYC. SwcPay still activates the account. |
SwcPay does not charge the customer, host checkout, talk to the PSP for you, send payment webhooks, refund, or settle funds.
What you cannot call
Routing-only keys cannot hit /api/v1/payments, UPI, or refunds. Those return
HTTP 403. Use /api/v1/routing/** only.
Go live
- SwcPay onboards you as Routing-only and activates the account.
- Ops attaches your MIDs (internal id, gateway-provided MID, daily limit, share %).
- Sign in at dashboard.swcindia.online → API keys. The secret is shown once.
- Call decide from your server. Never put the API key in a browser app.
Live OpenAPI: https://api-collections.swcindia.online/v3/api-docs/routing-only
Authenticate
X-Api-Key: {keyId}:{secret}
Content-Type: application/json
1. Decide a route
POST /api/v1/routing/decide (aliases: /payin/decide, /payout/decide)
{
"transactionRef": "ORD-10021",
"amount": 150.00,
"currency": "INR",
"idempotencyKey": "ORD-10021",
"paymentMethod": "UPI_INTENT",
"ipAddress": "203.0.113.42",
"customerRef": "cust_88a1",
"customer": { "vpa": "user@okhdfcbank" }
}
Always send ipAddress and a stable customerRef so same-user rules can run.
HTTP 200 ROUTED
Use selectedGateway + gatewayProvidedMid to start the payment on your stack. Persist decisionId.
HTTP 422 REJECTED
| rejectionReason | What to do |
|---|---|
NO_ELIGIBLE_GATEWAY | Fail the order or retry later. Do not guess a gateway. |
DUPLICATE_USER_MID_REQUEST | Ask the customer to wait, or fail. |
REPEATED_AMOUNT_GATEWAY | Wait or change amount context. |
Rejected decides are not counted toward distribution or daily limits.
HTTP 503
Hot store down. Fail closed. Do not pick a fallback gateway yourself.
2. Execute the payment yourself
Map the gateway to your existing PSP integration. If initiation never reached the PSP, call
decide again with that code in excludedGateways. Do not double-charge.
3. Report the outcome
POST /api/v1/routing/decisions/{decisionId}/outcome
{ "status": "SUCCESS", "pspErrorCode": null }
status must be SUCCESS, FAILED, TIMEOUT, or PENDING. First report wins.
4. Look up a decision
GET /api/v1/routing/decisions/{decisionId}
GET /api/v1/routing/decisions?transactionRef=ORD-10021
Copy-paste
BASE=https://api-collections.swcindia.online/api/v1
KEY='swcpay_yourKeyId:yourSecret'
curl -sS -X POST "$BASE/routing/decide" \
-H "X-Api-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{
"transactionRef": "ORD-10021",
"amount": 150.00,
"currency": "INR",
"idempotencyKey": "ORD-10021",
"paymentMethod": "UPI_INTENT",
"ipAddress": "203.0.113.42",
"customerRef": "cust_88a1"
}'
Checklist
- Store the API secret in your server vault.
- Send
ipAddressandcustomerRefevery time. - Persist
decisionIdnext to your order. - Execute only on the returned gateway + MID.
- Report an outcome for every ROUTED decision.
- On 422, do not collect. On 503, do not invent a route.