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
signature = encode(key_secret,key_id,key_secret,txncurr,amount,username,emailId,mobileNumber);
String key_id="IjjR3ODhr8dk2r4E";
String key_secret="0zusPqMRDAVBon2n";
String txncurr = "INR";
String name = "userfullname";
String amount = "10.00";
String email ="user-email@gmail.com";
String mobile ="9876543210";

String signature = SignatureKey.calculateRFC2104HMAC(key_secret,key_id,key_secret,txncurr,amount,name,email,mobile);

import java.security.SignatureException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
import org.apache.commons.codec.binary.Hex;

public class SignatureKey {
	 private static final String HMAC_SHA256_ALGORITHM = "HmacSHA256";
	    public static String calculateRFC2104HMAC(String secret,String ...data)
	    throws java.security.SignatureException
	    {
	        String result;
	        try {
	            // get an hmac_sha256 key from the raw secret bytes
	            SecretKeySpec signingKey = new SecretKeySpec(secret.getBytes(), HMAC_SHA256_ALGORITHM);
	            // get an hmac_sha256 Mac instance and initialize with the signing key
	            Mac mac = Mac.getInstance(HMAC_SHA256_ALGORITHM);
	            mac.init(signingKey);
	            String request = null;
				StringBuilder sb = new StringBuilder();
				for (String s : data) {
					sb.append(s);
				}
				request=sb.toString();
	            // compute the hmac on input data bytes
	            byte[] rawHmac = mac.doFinal(request.getBytes());
	            // base64-encode the hmac
	            result = DatatypeConverter.printHexBinary(rawHmac).toLowerCase();
	        } catch (Exception e) {
	            throw new SignatureException("Failed to generate HMAC : " + e.getMessage());
	        }
	        return result;
	    }
}

                

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.
email 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 saltKey  ="XXXXXXXXXXXXXXXXXX"; // Salt Key
String encryptionKey="XXXXXXXXXXXXXXXXXX"; // Encryption Key
JSONObject options = new JSONObject();
options.put("key_id", key_id);
options.put("key_secret", key_secret);
options.put("txnCurr", txncurr);
options.put("name",username);
options.put("amount",amount);
options.put("email", email);
options.put("mobile", mobile);
options.put("signature", signature);
options.put("udf1","Optional1");
options.put("udf2","Optional2");
data ={
    "amount": "100.00",
    "key_id": "XXXXXXXXXXXXXXXXXX",
    "key_secret": "XXXXXXXXXXXXXXXXXX",
    "signature": "9b7cbb12b61e8d924df99e12d63a8eea46a4feXXXXXXXXXXXXXXXXXX0e9edw2cdfae58df3bd112042423198",
    "mobile": "9876543210",
    "txnCurr": "INR",
    "email": "user-email@gmail.com",
    "name": "username",
    "udf1": "Optional1",
    "udf2": "Optional2"
    }

    private final byte[] ivBytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
    private String aesKey = "";
	private String saltIVKey = "";
	public String encryption(String options.toString(), String saltKey, String aesEncRequestKey)throws Exception
	{
		this.aesKey = aesEncRequestKey;
		this.saltIVKey = saltKey;
		return encryptJsonData(jsonToString);
	}

	private String encryptJsonData(String jsonToString) throws Exception
	{
		byte[] saltBytes = this.saltIVKey.getBytes("UTF-8");
		SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
		PBEKeySpec spec = new PBEKeySpec(this.aesKey.toCharArray(),saltBytes,	65536,256);
		SecretKey secretKey = factory.generateSecret(spec);
		SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), "AES");
		IvParameterSpec localIvParameterSpec = new IvParameterSpec(this.ivBytes);
		Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
		cipher.init(1, secret, localIvParameterSpec);
		byte[] encryptedTextBytes = cipher.doFinal(jsonToString.getBytes("UTF-8"));
		return byteToHex(encryptedTextBytes);
	}
	private String byteToHex(byte[] byData)	{
		StringBuffer sb = new StringBuffer(byData.length * 2);
		for (int i = 0; i < byData.length; ++i)	{
			int v = byData[i] & 0xFF;
			if (v < 16)
			sb.append('0');
			sb.append(Integer.toHexString(v));
			}
		return sb.toString().toUpperCase();
		}
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"
String saltKey ="XXXXXXXXXXXXXXXXXX"; // Salt Key
String encryptionKey = "XXXXXXXXXXXXXXXXXX"; // Encryption Key
decrypt= rsd.decryption(data, ResponseSaltKey, encryptionResponseKey );
private final byte[] ivBytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
private String aesKey = "";
private String saltIVKey = "";

public String decryption(String encryptedResponseData, String saltKey, String encryptionKey)throws Exception
{
this.aesKey = encryptionKey;
this.saltIVKey = saltKey;
return decryptResponseData(encryptedResponseData);
}
private String decryptResponseData(String encryptedResponseData)throws Exception
{
    byte[] saltBytes = this.saltIVKey.getBytes("UTF-8");
    byte[] encryptedTextBytes = hex2ByteArray(encryptedResponseData);
    SecretKeyFactory factory =	SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
    PBEKeySpec spec = new PBEKeySpec(this.aesKey.toCharArray(),saltBytes,65536,256);
    SecretKey secretKey = factory.generateSecret(spec);
    SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), "AES");
    IvParameterSpec localIvParameterSpec = new IvParameterSpec(this.ivBytes);
    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
    cipher.init(2, secret, localIvParameterSpec);
    byte[] decryptedTextBytes = (byte[])null;
    decryptedTextBytes = cipher.doFinal(encryptedTextBytes);
    return new String(decryptedTextBytes);
}

private byte[] hex2ByteArray(String sHexData)	{
    byte[] rawData = new byte[sHexData.length() / 2];
    for (int i = 0; i < rawData.length; ++i)	{
        int index = i * 2;
        int v = Integer.parseInt(sHexData.substring(index, index + 2), 16);
        rawData[i] = (byte)v;
    }
    return rawData;
}
                

Arthiqpay Payment Interface will receive the above Payment Request parameters encrypted using AES Encryption from the Merchant website. Request Salt Key and Request 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 txncurr should be required.
amount String Amount should be required.
name String username fullname should be required.
email 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. Response Salt Key and Response 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.
email 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
String key_secret = "xxxxxxxxxxxx";
#  "status+orderId+transactionId+bankId+description"

String signature = encode(key_secret,rp.getStatus(),rp.getOrderId(),rp.getTransactionId(),rp.getBankId(),rp.getDescription());

// generate hmac sha 256 hashkey
public static String encode(String key, String ...data) throws Exception {
    Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
    SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
    sha256_HMAC.init(secret_key);
    String request = null;

      StringBuilder sb = new StringBuilder();
      for (String s : data) {
          sb.append(s);
      }
      request=sb.toString();
    return Hex.encodeHexString(sha256_HMAC.doFinal(request.getBytes("UTF-8")));
  }

                

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.