Get started
API Endpoint
https://arthiqpay.com/
This document explains merchant integration with Arthiqpay payment gateway. The functionality of this application is to process online payments via credit cards, debit cards, net-banking and more.
Arthiqpay payment gateway will authenticate the application with the reference of the authentication credentials provided by the merchant during registration in the payment gateway portal. For example, in Arthiqpay payment gateway integration, the merchant has to be registered to get the API keys.
Signature Generation
# Here is a Signature generation example code:
name="userfullname";
email = "user-email@gmail.com";
mobile = "9876543210";
amount = "10.00"
txncurr ="INR"
key_id = "16027sPpTJF9UrYW";
key_secret = "SfOaB4k6ELvL9pze";
public string getHashKey()
{
string message = key_id + key_secret + txtcurr + amount + name + email + mobile;
signature = Hash_Hmac(message, key_secret); // api key_secret
return signature;
}
private string Hash_Hmac(string message, string secret)
{
secret = secret ?? "";
var encoding = new System.Text.ASCIIEncoding();
byte[] keyByte = encoding.GetBytes(secret);
byte[] messageBytes = encoding.GetBytes(message);
using (var hmacsha256 = new HMACSHA256(keyByte))
{
byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
Console.WriteLine(hashmessage);
return BitConverter.ToString(hashmessage).Replace("-", "").ToLower();
}
}
Signature parameter is created by hashing the value of below mentioned parameters. :
Sample Signature generated for the above
values is : 85e0006f0e24f92b3bd824bd0aa80fb7bf7a89e3ace452441c125fa66af247a1
REQUIRED PARAMETERS
| Field | Type | Description |
|---|---|---|
| key_id | String | Your API key. |
| key_secret | String | Your API Secret key. |
| txncurr | String | INR should be required. |
| amount | String | Amount should be required. |
| name | String | User fullname should be required. |
| String | User emailId should be required. | |
| mobile | String | Mobile number should be required. |
The hash value should be generated using HMACSHA256 algorithm with hash key. Hash key will be unique and shared by the Arthiqpay team. ‘signature’ parameter is mandatory and needs to be added in the request URL. Based on the api_secret parameter Hmac is generated. After receiving the request Arthiqpay Payment Interface will generate a signature using parameters present in the request and verify the generated signature with the signature which is present in the request URL. Users will be redirected to the payment page if both the signatures match.
AES Generation
AES Encryption
String salt ="XXXXXXXXXXXXXXXXXX"; //Request Salt Key
String aesKey="XXXXXXXXXXXXXXXXXX"; //Request Encryption Key
data={
"key_id": "XXXXXXXXXXXXXXXXXX",
"key_secret": "XXXXXXXXXXXXXXXXXX",
"signature": "9b7cbb12b61e8d924df99e12d63a8eea46a4feXXXXXXXXXXXXXXXXXX0e9edw2cdfae58df3bd112042423198",
"txnCurr": "INR",
"amount": "100.00",
"name": "username",
"email": "user-email@gmail.com",
"mobile": "9876543210",
"udf1": "Optional1",
"udf2": "Optional2"
}
# Convert Json data to string
Encryption Sample code:
public string Encrypt(string data, string salt, string aesKey)
{
// PBKDF2WithHmacSHA1 Key derivation
// ...
// .NET Framework 4.7.2 +
/*byte[] secretKey = null;
using (Rfc2898DeriveBytes rfc2898 = new Rfc2898DeriveBytes(aesKey, Encoding.UTF8.GetBytes(salt), 65536, HashAlgorithmName.SHA256))
{
secretKey = rfc2898.GetBytes(32);
}*/
// .NET Framework 4.5 +
byte[] secretKey = null;
KeyDerivationPrf keyDerivationPrf = KeyDerivationPrf.HMACSHA1;
secretKey = KeyDerivation.Pbkdf2(aesKey, Encoding.UTF8.GetBytes(salt), keyDerivationPrf, 65536, 32);
using (RijndaelManaged cipher = new RijndaelManaged())
{
cipher.Key = secretKey;
cipher.IV = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
cipher.Mode = CipherMode.CBC;
cipher.Padding = PaddingMode.PKCS7;
byte[] encryptedData;
using (ICryptoTransform encryptor = cipher.CreateEncryptor())
{
using (System.IO.MemoryStream memoryStream = new MemoryStream())
{
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
{
using (StreamWriter streamWriter = new StreamWriter(cryptoStream))
{
streamWriter.Write(data);
}
encryptedData = memoryStream.ToArray();
}
}
}
return ByteArrayToHex(encryptedData);
}
}
private static string ByteArrayToHex(byte[] barray)
{
char[] c = new char[barray.Length * 2];
byte b;
for (int i = 0; i < barray.Length; ++i)
{
b = ((byte)(barray[i] >> 4));
c[i * 2] = (char)(b > 9 ? b + 0x37 : b + 0x30);
b = ((byte)(barray[i] & 0xF));
c[i * 2 + 1] = (char)(b > 9 ? b + 0x37 : b + 0x30);
}
return new string(c);
}
Result example :
C71528A17125BBF0FF984E7B1060AE5B02A7FF3060733B00CB29B02ADA446F0063E7CB910C8B7A07ADA65DDF7C2DE1AA7D
855DCA0226E1C9351230F8331404940DC15C69D35C6BB8CAD96F5ABB6D9D8F0C6FE2A49DE73D24ACFA1B5F284C7EC804199E
8E7CE75E411FC277DE5255CCA49CF593422E29DD8F27AEBDE680D862491E2872245CF02A77BE6ED6F78EFACBF0AF1B3D4A809
0A3FCB0A33443AFBE212ABE87B0C73A6FF2A74D7F1BDA4CCDDD3FDCC76AWSAWQW35FB0322149E62ED92E6D569D0FC68A27AFA140BF05
1864FE4A660A7F0B94ABF24C3976988528D6CBC521727E46C8623CFC19B0B4BA1F578D4DD0747D63935357FEA5C790B884AF777D
282346C68FFE8C99C4FD6711140539638DA7240101AEBB117BAD2941B08EEDA6E140125DBE8C5663F67987CA7358BDAFAAA1E94A
3141479ACF998E1C54757EC26C13A2003F8A5E3BB00B9A7D7A956DE5CC0CAC5E
# This is for response data to the decrypt method.:
String data = "41E033CFCAAFF9A29D06975757B7EB9EC6BE28D16E04D4E091ACC5DAFC24E3D79A22A
65671A9C6B2BD32C1C0A28FFDC5A19EE91551C5F5C8661323C961E9B940344CA23E1046CBF0
4AA199408846565C3F03D1272D94F8741320DD54C9A0CFC8B675F677CA4D5790EF53838CC72
BB45E156F0EC39C8E7DA5464636D8079D288BDFB6D7D41DD0E3117B0C09E019AA3F268F40E
700A3CDDCEBF47BF8D1CFDA62C95F0E1D140AFA2D0AA28FD2BEE4853E2ECAC58926588201
23EC1D9FEDDC45CBCAE13FE47FEC1F662A674503D2AF29511629BEBBCFCAE0A9BF9C47172
7CE878E803D3F6ECAB12DD5A39D929182FDFE1018A9E66B36B8E4F89081DB63EB447AB9516
D432E49409C40C09F56D3400B2F71BD072FEC45E5181F714E900E3DE3D59BD2"
salt ="XXXXXXXXXXXXXXXXXX"; // Salt Key
aesKey = "XXXXXXXXXXXXXXXXXX"; // Encryption Key
public string Decrypt(string encryptedText, string salt, string aesKey)
{
byte[] encryptedTextBytes = HexStringToByte(encryptedText);
// PBKDF2WithHmacSHA1 Key derivation
// ...
byte[] secretKey = null;
KeyDerivationPrf keyDerivationPrf = KeyDerivationPrf.HMACSHA1;
secretKey = KeyDerivation.Pbkdf2(aesKey, Encoding.UTF8.GetBytes(salt), keyDerivationPrf, 65536, 32);
using (RijndaelManaged cipher = new RijndaelManaged())
{
cipher.Key = secretKey;
cipher.IV = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
cipher.Mode = CipherMode.CBC;
cipher.Padding = PaddingMode.PKCS7;
string decryptedText;
using (ICryptoTransform decryptor = cipher.CreateDecryptor())
{
using (System.IO.MemoryStream memoryStream = new MemoryStream(encryptedTextBytes))
{
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read))
{
using (StreamReader streamReader = new StreamReader(cryptoStream))
{
decryptedText = streamReader.ReadToEnd();
}
}
}
}
return decryptedText;
}
}
protected static byte[] HexStringToByte(string hexString)
{
try
{
int bytesCount = (hexString.Length) / 2;
byte[] bytes = new byte[bytesCount];
for (int x = 0; x < bytesCount; ++x)
{
bytes[x] = Convert.ToByte(hexString.Substring(x * 2, 2), 16);
}
return bytes;
}
catch
{
throw;
}
}
Arthiqpay Payment Interface will receive the above Payment Request parameters encrypted
using AES Encryption from the Merchant website. Salt Key and Encryption
key are the keys used for the generation of AES encryption String.
Result example :
{
"date": "January 04, 2024, 01:08 am",
"amount": 100,
"key_id": "XXXXXXXXXXXXXXXXXX",
"orderId": "OID5BmU9LFT9aXwIxg",
"signature": "764d4442a3dcc16jie83hd5d914b769af40ee8489067172d8074e1fddbe26784ce0155a",
"mobile": "9876543210",
"description": "Transaction Successful",
"udf1": "Optional Parameter",
"udf2": "Optional Parameter",
"transactionId": "ATPcYxJN6InaEXk8o7",
"bankId": "123456",
"email": "user-email@gmail.com",
"status": "200"
}
REQUIRED PARAMETERS
| Field | Type | Description |
|---|---|---|
| key_id | String | Your API key. |
| key_secret | String | Your API Secret key. |
| txncurr | String | INR should be required. |
| amount | String | Amount should be required. |
| name | String | User fullname should be required. |
| String | User emailId should be required. | |
| mobile | String | Mobile number should be required. |
| signature | String | should be required. |
| udf1 | String | (optional) |
| udf2 | String | (optional) |
AES Decryption
Merchant will receive the above Payment Response parameters decrypted using AES Decryption from Arthiqpay Payment Interface. Salt Key and AES key are the keys used for the generation of AES decryption String.
Request Payload
# Here is a curl example
curl \
-X POST https://arthiqpay.com/payment/gateway/test/request \
-F 'key_id=your_api_key' \
-F 'data=aes_data'
To get characters you need to make a POST call to the following url :
https://arthiqpay.com/payment/gateway/test/request
key_id = xxxxxxxxxxxx
data=41E033CFCAAFF9A29D06975757B7EB9EC6BE28D16E04D4E091ACC5DAFC24E3D79A22A
65671A9C6B2BD32C1C0A28FFDC5A19EE91551C5F5C8661323C961E9B940344CA23E1046CBF0
4AA199408846565C3F03D1272D94F8741320DD54C9A0CFC8B675F677CA4D5790EF53838CC72
BB45E156F0EC39C8E7DA5464636D8079D288BDFB6D7D41DD0E3117B0C09E019AA3F268F40E
700A3CDDCEBF47BF8D1CFDA62C95F0E1D140AFA2D0AA28FD2BEE4853E2ECAC58926588201
23EC1D9FEDDC45CBCAE13FE47FEC1F662A674503D2AF29511629BEBBCFCAE0A9BF9C47172
7CE878E803D3F6ECAB12DD5A39D929182FDFE1018A9E66B36B8E4F89081DB63EB447AB9516
D432E49409C40C09F56D3400B2F71BD072FEC45E5181F714E900E3DE3D59BD2
REQUIRED PARAMETERS
| Field | Type | Description |
|---|---|---|
| key_id | String | Your API key. |
| data | String | Encrypted data. |
Response Payload
# Here is a response example
key_id = "your key id"
data = "41E033CFCAAFF9A29D06975757B7EB9EC6BE28D16E04D4E091ACC5DAFC24E3D79A22A
65671A9C6B2BD32C1C0A28FFDC5A19EE91551C5F5C8661323C961E9B940344CA23E1046CBF0
4AA199408846565C3F03D1272D94F8741320DD54C9A0CFC8B675F677CA4D5790EF53838CC72
BB45E156F0EC39C8E7DA5464636D8079D288BDFB6D7D41DD0E3117B0C09E019AA3F268F40E
700A3CDDCEBF47BF8D1CFDA62C95F0E1D140AFA2D0AA28FD2BEE4853E2ECAC58926588201
23EC1D9FEDDC45CBCAE13FE47FEC1F662A674503D2AF29511629BEBBCFCAE0A9BF9C47172
7CE878E803D3F6ECAB12DD5A39D929182FDFE1018A9E66B36B8E4F89081DB63EB447AB9516
D432E49409C40C09F56D3400B2F71BD072FEC45E5181F714E900E3DE3D59BD2"
Arthiqpay will post back on to return URL of the merchant :
Result example :
{
"date": "January 04, 2024, 01:08 am",
"amount": 100,
"key_id": "XXXXXXXXXXXXXXXXXX",
"orderId": "OID5BmU9LFT9aXwIxg",
"signature": "764d4442a3dcc16jie83hd5d914b769af40ee8489067172d8074e1fddbe26784ce0155a",
"mobile": "9876543210",
"description": "Transaction Successful",
"udf1": "Optional Parameter",
"udf2": "Optional Parameter",
"transactionId": "ATPcYxJN6InaEXk8o7",
"bankId": "123456",
"email": "user-email@gmail.com",
"status": "200"
}
RESPONSE PARAMETERS
| Field | Type | Description |
|---|---|---|
| status | String | 200 – Success 400 – Failure 402 – Cancel Transaction |
| api_key | String | xxxxxxxxxxxxxxxxx. |
| orderId | String | oidIXz1Rh9eBot9yrzC. |
| transactionId | String | ATPOLBNevJFedt0lVg. |
| bankId | String | 02756830364. |
| txnCurr | String | INR. |
| amount | String | 100.00. |
| String | user-email@gmail.com. | |
| mobile | String | 9876543210. |
| signature | String | 68aa3b7c0af1b5322159669f82108e 20803e283c34ebacfe1688049b48dc128 5. |
| date | String | Date. |
| udf1 | String | (optional) |
| udf2 | String | (optional) |
Signature Validation
# Here is a Signature generation example code
# "status+orderId+transactionId+bankId+description"
string valid = status+orderId+transactionId+bankId+description;
string key_secret = "xxxxxxxxxxxx";
// generate hmac sha 256 hashkey
public string getHmacCalc() {
string validate = this.status +this.orderId +this.bankId +this.transactionId + this.description;
string HmacCalc = Hash_Hmac(validate, key_secret);
return HmacCalc;
}
private string Hash_Hmac(string validate, string secret)
{
secret = secret ?? "";
var encoding = new System.Text.ASCIIEncoding();
byte[] keyByte = encoding.GetBytes(secret);
byte[] messageBytes = encoding.GetBytes(validate);
using (var hmacsha256 = new HMACSHA256(keyByte))
{
byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
Console.WriteLine(hashmessage);
return BitConverter.ToString(hashmessage).Replace("-", "").ToLower();
}
}
Signature parameter is created by hashing the value of below mentioned parameters. :
Sample Signature generated for the above
values is : 85e0006f0e24f92b3bd824bd0aa80fb7bf7a89e3ace452441c125fa66af247a1
REQUIRED PARAMETERS
| Field | Type | Description |
|---|---|---|
| status | String | Response status code. |
| orderId | String | Response order id . |
| transactionId | String | Response Transaction Id . |
| bankId | String | Response Bank Id. |
| description | String | Transaction response description. |
INTENT REQUEST
Request JSON:
{
"amount": "100.00",
"key_id": "yiu0gQkjzU5gpe4c",
"signature": "04b565248d9afdc9b1dc74abaf7da055cc1a1f6087073f615f122b61a4263570",
"name": "username",
"mobile": "9876543210",
"txnCurr": "INR",
"key_secret": "X6QqsDQg0JZxLXVZ",
"udf1": "Optional Parameter89_.",
"udf2": "Optional Parameter",
"email": "user-email@gmail.com"
}
# Here is a curl example
curl -X POST https://arthiqpay.com/payment/gateway/v1/test/intent/request \
-H 'Content-Type: application/json' \
-d '{"key_id":"xxxxxxxxxxxxxxxxx",
"data":"F19086D559B28AD90C728B4BB1DE7EE392C1CAAB5466C59AE80D60F81460D3C572B209D10E6E
B114396141D3E26636A095069FB08EA699993F249770DF5212FCE9472A08377E93FD1A5E9B5D0144F8EC
89A61BC902FF3CF0001E7C45EE638A6CB83A652C66E5050B9869C36BB617A9F2A684368C5C4A140235F0
C5439BAD9C96EFB3363E96DBFE43A10AB6F69844E17EE349D0A847C97BA665844DB46DD81A9F65B28DFF
BE6BBB110A5987BAB774653D93ED5434D83F564B5881DDCCE32F71CBD9FC22DD8CBECF2ADF7D8BB5BDD1
982B828D56267879EC1530A5F3543CD9DD17A43136059DFA4E128A08D1CE1E4DC9668E61AD2C5C53DE19
5A6A705243E552FBA47F54208F800EFF3947F6E1BAD72A0895857A77736CE8898F1DEDCA3A8B158A0828
FBAD15157061CCAE58CC22C6CE72975447B8D9B7B7B742427E542B041A24"
}'
To get characters you need to make a POST call to the following url :
API Endpoint
https://arthiqpay.com/
{TEST}/payment/gateway/v1/test/intent/request
{Live}/payment/gateway/v1/live/intent/request
Result example :
{
"key_id":"xxxxxxxxxxxxxxxxx",
"data":"4F140ED08F0C7B14B972B5060952981A90C91A8A7DDC012146C162BDD433093B5BE1B61A6E48
42913521CE443868C76DF2FA2F6C8AD150F311F1D8FBFDCC0A173711B26064FB11F981B2FD83081D3BEE
9423907F87F27841C1F748367115057868AB5656027B120BBA309695559475600FD5257F203E089AA252
EB9424DD644969514DA6BEEE361E683E9A70F576D0E25EC4CDB15B424D1004F37EF75F29DEBE576D1171
AEA10669DC68F84FFF50A24F627DF14605DBEC1321472971BD6194C7380805DAD52718131BD5FFB92632
37421A71187E59912E73A1370ADBD710ED63D64FF8B1919512589B5ABA06AD849A008E39208021DF3C1E
65E8CB590ED123A297D37B0249988D3FBD45076416E250BC7179426C843E8D32AFB5CB44FEE604126D90
D310BE3D749F0969AC9F73617945C7196E3700897E54CA50A78FCB3C36BFF14616CD3660B59F484A9116
9F5BF40D7B765EB2EB5FB8619CED9720DF0D08335AC791C8F569AF2F3ABA2EBE17B67A76C92F8F749842
1F18B00D9A3CFE6B20AAFA9E84B4E6169C886F024BB8C9C9ED001BB3C56B0D90A62E9ED199C80FDC1F3D
F2DFE7D1EAC3C01F8C96296D865834AC6E7EE6949A955FE2A54B12C521200B4988A1BFE9A7B474589436
C9081689C91B449E4488FC6FB763970A2FC0EAEDDE7D839B680FFC6C7E5F7FBD85760A74DA2B05EEE5CD
803E32BE5CC218F3986CB2D7ADC4E429CC294A26954F22295A90723A243B0749C77EAF72235906B4721B
9316E0C1B4C72A647BF09CE4EF6C40B9959BC313E6B081444725A64ED10F348D984C454DF177B9B71AC0
E64D0CA252AEFA82"
}
Response JSON:
{
"amount": 100,
"upiIntent": "upi://pay?pa=test%40axisbank&pn=Test%20Merchant&mc=1234&tr=123456789&tn=test%20transaction%20note&am=10.01&cu=INR&url=https%3A%2F%2arthiqpay/payment/gateway/response",
"orderId": "OIDnCNMwVxGJkrjLjA",
"signature": "04b565248d9afdc9b1dc74abaf7da055cc1a1f6087073f615f122b61a4263570",
"mobile": "9876543210",
"description": "Do Not Modify UPI String",
"udf1": "Optional Parameter89_.",
"udf2": "Optional Parameter",
"transactionId": "ATPeN6WNaQwdnIqpIj",
"name": "username",
"txnCurr": "INR",
"email": "user-email@gmail.com",
"status": "success",
"statusCode": "200"
}
REQUIRED PARAMETERS
| Field | Type | Description |
|---|---|---|
| key_id | String | Your API key. |
| data | String | Encrypted data. |
Errors
The INTENT API uses the following error codes:
| Error Code | Meaning |
|---|---|
| 301 | Key Id is Required. |
| 302 | Data is Required. |
| 303 |
Invalid Key Id.
|
| 304 | Invalid Encrypted Data |
| 305 | Signature Mismatch |
| 306 | Name is Invalid/Empty. |
| 307 | key_id is Empty. |
| 308 | key_secret is Empty. |
| 309 | Email is Invalid/Empty. |
| 310 | Mobile Number is Invalid/Empty. |
| 311 | Currency Type is Invalid/Empty. |
| 312 | Amount is Invalid/Empty. |
| 313 | Amount Value is Excess Than Ticket Limit. |
PAYIN STATUS API
# Here is a curl example
curl -X GET https://arthiqpay.com/sapi/payin_status \
-H 'Content-Type: application/json' \
-d '{
"key_id":"xxxxxxxxxxxxxxxxx",
"data":"F19086D559B28AD90C728B4BB1DE7EE392C1CAAB5466C59AE80D60F81460D3C572B209D10E6E
B114396141D3E26636A095069FB08EA699993F249770DF5212FCE9472A08377E93FD1A5E9B5D0144F8EC
89A61BC902FF3CF0001E7C45EE638A6CB83A652C66E5050B9869C36BB617A9F2A684368C5C4A140235F0
C5439BAD9C96EFB3363E96DBFE43A10AB6F69844E17"
}'
To get payin status you need to make a GET call to the following url :
API Endpoint
https://arthiqpay.com/sapi/payin_status
Result example :
{
"key_id":"xxxxxxxxxxxxxxxxx",
"data":"4F140ED08F0C7B14B972B5060952981A90C91A8A7DDC012146C162BDD433093B5BE1B61A6E48
42913521CE443868C76DF2FA2F6C8AD150F311F1D8FBFDCC0A173711B26064FB11F981B2FD83081D3BEE
9423907F87F27841C1F748367115057868AB5656027B120BBA309695559475600FD5257F203E089AA252
EB9424DD644969514DA6BEEE361E683E9A70F576D0E25EC4CDB15B424D1004F37EF75F29DEBE576D1171
AEA10669DC68F84FFF50A24F627DF14605DBE"
}
REQUIRED PARAMETERS
| Field | Type | Description |
|---|---|---|
| key_id | String | Your API key |
| key_secret | String | Your Secret Key. |
| transaction_id | String | Your Transaction ID |
| udf1 | String | Your Order ID |
API REQUEST PARAMETERS
| Field | Type | Description |
|---|---|---|
| key_id | String | Your API key. |
| data | String | Encrypted data. |