AffxPay API Documentation

Explore our GET APIs and Webhooks for secure and efficient payout solutions.

Introduction

Welcome to the AffxPay API documentation. Our API suite allows you to process payments, check statuses, query account balances, and send SMS notifications. We also support webhook events to keep you updated on payment statuses in real time.

Authentication

API Key

All API requests must include your API key in the request header to authenticate access to AffxPay’s services. Obtain your API key upon registration.

Request Example:
https://affxpay.com/api/FUNCTION?api=YOUR_API_KEY
Parameters:
  • YOUR_API_KEY : API Key.

API Endpoints

1. Payment API

Initiate a new payment request.

Endpoint:
GET https://affxpay.com/api/pay?upi={UPI}&amount={amount}&comment={comment}&api=YOUR_API_KEY
Parameters:
  • upi : User Upi Id.
  • amount : Amount you want to pay.
  • comment : Remark for the payment. (24 char max)
Sample Response:
{
"status":"processing",
"message":"Payment Processing Will Get Reflected in 1 Hour",
"ip":"152.59.49.161",
"time":1730819789,
"upi":"1234567890@upi",
"amount": 10,
"trx_id":"KB7OMLN5CS248WAZP6GUHTQ0",
"bank_trx_id":"tr_o71WkUS2cVm1mYnHr3jxNaMiP",
"closing_balance":"9989.70"
}

2. Payment Status API

Retrieve the status of a specific payment.

Endpoint:
GET https://affxpay.com/api/fetch-balance?api=YOUR_API_KEY
Parameters:
  • transaction_id (string): Unique ID of the transaction.
Sample Response:
{
"status":"success",
"time":1730820097,
"upi":"1234567890@upi",
"amount":"10",
"trx_id":"KB7OMLN5CS248WAZP6GUHTQ0",
"bank_trx_id":"tr_o71WkUS2cVm1mYnHr3jxNaMiP"
}

3. Account Balance API

Get the current balance in your AffxPay account.

Endpoint:
GET https://affxpay.com/api/fetch-balance?api=YOUR_API_KEY
Sample Response:
{
"status":"success",
"balance":"10000",
"ip":"152.59.49.161",
"time":1730820341
}

4. SMS API

Send an SMS notification to a user.

Endpoint:
GET Adding Soon
Parameters:
  • phone (string): Recipient's phone number.
  • camp (string): Camp Name
Sample Response:
{
"status":"success",
"message":"Message Sent Successfully",
"ip":"152.58.41.224",
"time":1730930774,
"trx_id":null,
"mobile_no":"6263852598",
"closing_balance":9999.70
}

Webhooks

1. Payment Requested Webhook

Triggered when a new payment request is initiated.

Webhook Payload:
{
"event": "payment_requested",
"transaction_id": "123456789",
"amount": 100,
"currency": "INR",
"beneficiary_upi": "johndoe@upi",
"status": "pending",
"created_at": "2024-11-05T09:00:00Z"
}

2. Payment Status Updated Webhook

Triggered when the status of a payment request changes.

Webhook Payload:
{
  "event": "payment_status_updated",
  "transaction_id": "123456789",
  "status": "completed",
  "updated_at": "2024-11-05T10:00:00Z"
}

Api Failure Reasons

Here are some common reasons why API requests may fail. Each failure type includes an error code and a message to help you diagnose and resolve issues efficiently.

1. Invalid API Key

If the API key provided in the request is incorrect or has expired, the following error will be returned.

Error Response:
{
"error_code": "401",
"error_message": "Invalid API Key. Please check your API credentials."
}

2. IP Not Whitelisted

Your request will be denied if it originates from an IP address that has not been added to the whitelist. Ensure that all IPs used for requests are registered in your account settings.

Error Response:
{
"status":"failed",
"message":"Ip Not WhiteListed",
"ip":"152.59.49.161",
"time":1730819619,
"trx_id":null
}

3. Missing Required Fields

All required fields must be included in the request payload. Omitting any required parameter will result in a failure response with the missing field specified.

Error Response:
{
"error_code": "400",
"error_message": "Missing required fields: [field_name]"
}

4. Insufficient Balance

If your account balance is too low to process the transaction, a failure response will indicate the issue. Please ensure you have sufficient balance before making a request.

Error Response:
{
"error_code": "402",
"error_message": "Insufficient balance. Please recharge your account."
}