Thank you for being partner with PayAgency.
If you want to accept payments on your app ,website then you can integrate our API. which provide seamless integration and performance . Our payment API can be used to integrate with any platform of your choice.
All the request are protected with bearer token. You need to pass Secret-Key to authenticate request. You can find Secret-key for each profile in Settings menu.
HeadersField | Description |
---|---|
Content-Type | application/json |
Accept | application/json |
Authorization |
Bearer YOUR-SECRET-KEY
You have to pass your secret key inside the Authorization header.. |
Parameters with * are required.
You can pass other parameters as well, if you already collect from the user. Each connector has certain required parameters to process the transactions. If you have not passed any of the below parameters that are required in the connector, then you will get auth_url
in the response, where it will ask user to input this detail.
Field | Description |
---|---|
first_name * | User's first name appears on his/her Credit/Debit Card.
Example :- James |
last_name * | User's last name appears on his/her Credit/Debit Card.
Example :- Toni |
email * | User's active email address. This essential information ensures seamless communication and
enables access to personalized features and updates.
Example :- james@gmail.com |
currency * | Currency code Example :- USD |
amount * | Transaction amount . Example :- 100.25 |
ip_address * | IP Address(IPV4) of user device. Example :- 192.89.0.2 |
response_url * | Url of merchant website. We will redirect here after transaction completes. Example :- https://google.com |
order_id | Merchant transaction unique id. Example :- 5625235FGFS |
phone_number | User active mobile number. Example :- 7767545432 |
zip | User resident zipcode. Example :- 654213 |
address | User resident address. Example :- 4013 Loving Acres Road |
city | User city. Example :- San Diego |
state | User state or province. Example :- California |
country | User 2 Character country code. Example :- US |
card_number | Credit/Debit card number. Example :- 42424242424242 |
card_expiry_month | Credit/Debit card expiry month. Example :- 11 |
card_expiry_year | Credit/Debit card expiry year. Example :- 2027 |
card_cvv | Credit/Debit card CVV or CVC. It is 3 or 4 digit number at the back of the card Example :- 123 |
terminal_id | Account id of connector account. If included in the request, transaction will bypass all routing and cascadings and process through the specific this connector account. Example :- T8445650 |
webhook_url | Url of the merchant website. Our system will send server webhooks to update final transaction status. Example :- https://webhook.site/6e5b38bf-2b96-4ce6-819e-343a7842b43d |
These are the possible response you will receive in the payment API. You will need to handle transaction according to the response you receive.
status | transaction.result.status | Description |
---|---|---|
200 | success | Transaction processed successfully and no other action required. |
300 | redirected | Transaction required 3DS authentication. You will need to redirect user auth_url parameter received in the response.
|
303 | pending | Transaction in pending status. Wait for few minutes to receive final webhooks from our server or call Status API to get current status. |
304 | to_be_confirm | Transaction is processed but yet to be confirmed from the bank side. Generally confirms in minutes after transaction processed. Wait for a minute to receive final webhooks from our server or call Status API to get current status. |
400 | failed | Transaction is declined by the connector. transaction.result.message included the message from the bank. No other action required. No action required. |
401 | - | Authentication failed. Wrong or no secret key passsed in the header. |
402 | - | Validation failed. Wrong or no required parameters passed in the payment API. |
403 | blocked | Transaction is blocked. PayAgency system blocked the transaction due to some limits or restriction set by the merchant in connector configuration. |
curl --location 'https://api.pay.agency/v1/live/transaction' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-SECRET-KEY' \
--data-raw '{
"order_id":"642632732",
"first_name":"James",
"last_name":"Toni",
"email":"james_Toni@gmail.com",
"phone_number":"789611212",
"ip_address":"192.12.12.7",
"zip":" 92117",
"address":"4013 Loving Acres Road",
"city":"New York",
"state":"California",
"country":"US",
"amount":15.00,
"currency":"USD",
"card_number":"5555555555554444",
"card_expiry_month":11,
"card_expiry_year":2024,
"card_cvv":454,
"response_url":"https://google.com",
"webhook_url":"https://webhook.site/b878bc5b-7562-4145-9632-bccf3ccfb9a2"
}'
<?php
$data = [
'order_id' => time(),
'first_name' => 'James',
'last_name' => 'Toni',
'email' => 'james_Toni@gmail.com',
'phone_number' => '789611212',
'ip_address' => '192.12.12.7',
'zip' => '4013 Loving Acres Road',
'city' => 'San Diego',
'state' => 'California',
'country' => 'US',
'amount' => '10.50',
'currency' => 'USD',
'card_number' => '5555555555554444',
'card_expiry_month' => '11',
'card_expiry_year' => '2024',
'card_cvv' => 'https://google.com',
"response_url":"https://google.com",
'webhook_url' => 'https://webhook.site/b878bc5b-7562-4145-9632-bccf3ccfb9a2'
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => https://api.pay.agency/v1/live/transaction,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 0,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer YOUR-SECRET-KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer YOUR-SECRET-KEY");
var raw = JSON.stringify({
"order_id": "642632732",
"first_name": "James",
"last_name": "Toni",
"email": "james_Toni@gmail.com",
"phone_number": "789611212",
"ip_address": "192.12.12.7",
"zip": " 92117",
"address": "4013 Loving Acres Road",
"city": "New York",
"state": "California",
"country": "US",
"amount": 15,
"currency": "USD",
"card_number": "5555555555554444",
"card_expiry_month": 11,
"card_expiry_year": 2024,
"card_cvv": 454,
"response_url": "https://google.com",
"webhook_url": "https://webhook.site/b878bc5b-7562-4145-9632-bccf3ccfb9a2"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.pay.agency/v1/live/transaction", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var axios = require('axios');
var data = JSON.stringify({
"order_id": "642632732",
"first_name": "James",
"last_name": "Toni",
"email": "james_Toni@gmail.com",
"phone_number": "789611212",
"ip_address": "192.12.12.7",
"zip": " 92117",
"address": "4013 Loving Acres Road",
"city": "New York",
"state": "California",
"country": "US",
"amount": 15,
"currency": "USD",
"card_number": "5555555555554444",
"card_expiry_month": 11,
"card_expiry_year": 2024,
"card_cvv": 454,
"response_url": "https://google.com",
"webhook_url": "https://webhook.site/b878bc5b-7562-4145-9632-bccf3ccfb9a2"
});
var config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.pay.agency/v1/live/transaction',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR-SECRET-KEY'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"order_id\":\"642632732\",\n \"first_name\":\"James\",\n \"last_name\":\"Toni\",\n \"email\":\"james_Toni@gmail.com\",\n \"phone_number\":\"789611212\",\n \"ip_address\":\"192.12.12.7\",\n \"zip\":\" 92117\",\n \"address\":\"4013 Loving Acres Road\",\n \"city\":\"New York\",\n \"state\":\"California\",\n \"country\":\"US\",\n \"amount\":15.00,\n \"currency\":\"USD\",\n \"card_number\":\"5555555555554444\",\n \"card_expiry_month\":11,\n \"card_expiry_year\":2024,\n \"card_cvv\":454,\n \"response_url\":\"https://google.com\",\n \"webhook_url\":\"https://webhook.site/b878bc5b-7562-4145-9632-bccf3ccfb9a2\"\n}");
Request request = new Request.Builder()
.url("https://api.pay.agency/v1/live/transaction")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer YOUR-SECRET-KEY")
.build();
Response response = client.newCall(request).execute();
import http.client
import json
conn = http.client.HTTPSConnection("localhost", 8000)
payload = json.dumps({
"order_id": "642632732",
"first_name": "James",
"last_name": "Toni",
"email": "james_Toni@gmail.com",
"phone_number": "789611212",
"ip_address": "192.12.12.7",
"zip": " 92117",
"address": "4013 Loving Acres Road",
"city": "New York",
"state": "California",
"country": "US",
"amount": 15,
"currency": "USD",
"card_number": "5555555555554444",
"card_expiry_month": 11,
"card_expiry_year": 2024,
"card_cvv": 454,
"response_url": "https://google.com",
"webhook_url": "https://webhook.site/b878bc5b-7562-4145-9632-bccf3ccfb9a2"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR-SECRET-KEY'
}
conn.request("POST", "/api/v1/live/transaction", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
{
"status": 200,
"message": "success",
"transaction": {
"order_id": "test",
"transaction_id": "T111704976631P1PXJ",
"terminal_id": null,
"customer": {
"first_name": "test",
"last_name": "test",
"email": "test@gmail.com",
"phone_number": "789611212"
},
"billing": {
"zip": "test",
"address": "test",
"city": "test",
"state": "test",
"country": "US"
},
"payment_details": {
"card_number": "555555XXXXXX4444",
"card_expiry_month": "11",
"card_expiry_year": "2024",
"card_cvv": "XXX"
},
"order": {
"amount": "15.00",
"currency": "USD"
},
"device": {
"ip_address": "192.12.12.7"
},
"result": {
"status": "success",
"message": "Transaction processed successfully."
},
"refund": {
"status": false,
"refunded_on": null
},
"chargebacks": {
"status": false,
"chargebacked_on": null
}
}
}
{
"status": 300,
"message": "redirected",
"auth_url": "http://bankwebsite.com/eyJpdiI6IjA1cU5CNGVsdkhKMX",
"transaction": {
"order_id": "test",
"transaction_id": "T1117049767226OYOF",
"terminal_id": null,
"customer": {
"first_name": "test",
"last_name": "test",
"email": "test@gmail.com",
"phone_number": "789611212"
},
"billing": {
"zip": "test",
"address": "test",
"city": "test",
"state": "test",
"country": "US"
},
"payment_details": {
"card_number": "426398XXXXXX9299",
"card_expiry_month": "11",
"card_expiry_year": "2024",
"card_cvv": "XXX"
},
"order": {
"amount": "15.00",
"currency": "USD"
},
"device": {
"ip_address": "192.12.12.7"
},
"result": {
"status": "redirected",
"message": "Authontication required."
},
"refund": {
"status": false,
"refunded_on": null
},
"chargebacks": {
"status": false,
"chargebacked_on": null
}
}
}
{
"status": 303,
"message": "pending",
"transaction": {
"order_id": "test",
"transaction_id": "T111704976774SH5YB",
"terminal_id": null,
"customer": {
"first_name": "test",
"last_name": "test",
"email": "test@gmail.com",
"phone_number": "789611212"
},
"billing": {
"zip": "test",
"address": "test",
"city": "test",
"state": "test",
"country": "US"
},
"payment_details": {
"card_number": "374245XXXXXX0126",
"card_expiry_month": "11",
"card_expiry_year": "2024",
"card_cvv": "XXX"
},
"order": {
"amount": "15.00",
"currency": "USD"
},
"device": {
"ip_address": "192.12.12.7"
},
"result": {
"status": "pending",
"message": "Transaction pending for approval."
},
"refund": {
"status": false,
"refunded_on": null
},
"chargebacks": {
"status": false,
"chargebacked_on": null
}
}
}
{
"status": 304,
"message": "to_be_confirm",
"transaction": {
"order_id": "test",
"transaction_id": "T111704976819GA5M5",
"terminal_id": null,
"customer": {
"first_name": "test",
"last_name": "test",
"email": "test@gmail.com",
"phone_number": "789611212"
},
"billing": {
"zip": "test",
"address": "test",
"city": "test",
"state": "test",
"country": "US"
},
"payment_details": {
"card_number": "400000XXXXXX1976",
"card_expiry_month": "11",
"card_expiry_year": "2024",
"card_cvv": "XXX"
},
"order": {
"amount": "15.00",
"currency": "USD"
},
"device": {
"ip_address": "192.12.12.7"
},
"result": {
"status": "to_be_confirm",
"message": "Transaction to be confirmed."
},
"refund": {
"status": false,
"refunded_on": null
},
"chargebacks": {
"status": false,
"chargebacked_on": null
}
}
}
{
"status": 400,
"message": "failed",
"transaction": {
"order_id": "test",
"transaction_id": "T111704976876JNQQU",
"terminal_id": null,
"customer": {
"first_name": "test",
"last_name": "test",
"email": "test@gmail.com",
"phone_number": "789611212"
},
"billing": {
"zip": "test",
"address": "test",
"city": "test",
"state": "test",
"country": "US"
},
"payment_details": {
"card_number": "601111XXXXXX1117",
"card_expiry_month": "11",
"card_expiry_year": "2024",
"card_cvv": "XXX"
},
"order": {
"amount": "15.00",
"currency": "USD"
},
"device": {
"ip_address": "192.12.12.7"
},
"result": {
"status": "failed",
"message": "Insufficient Fund."
},
"refund": {
"status": false,
"refunded_on": null
},
"chargebacks": {
"status": false,
"chargebacked_on": null
}
}
}
{
"status": 401,
"message": "Invalid Secret key."
}
{
"status": 402,
"message": "Error, please check errors paramter.",
"errors": {
"first_name": [
"The first name field is required."
],
"email": [
"The email field must be a valid email address."
]
}
}
{
"status": 403,
"message": "blocked",
"transaction": {
"order_id": "test",
"transaction_id": "T11170497705605FYT",
"terminal_id": null,
"customer": {
"first_name": "test",
"last_name": "test",
"email": "test@gmail.com",
"phone_number": "789611212"
},
"billing": {
"zip": "test",
"address": "test",
"city": "test",
"state": "test",
"country": "US"
},
"payment_details": {
"card_number": "601111XXXXXX1117",
"card_expiry_month": "11",
"card_expiry_year": "2023",
"card_cvv": "XXX"
},
"order": {
"amount": "15.00",
"currency": "USD"
},
"device": {
"ip_address": "192.12.12.7"
},
"result": {
"status": "blocked",
"message": "Expired card."
},
"refund": {
"status": false,
"refunded_on": null
},
"chargebacks": {
"status": false,
"chargebacked_on": null
}
}
}