Setup Subscription (Transaction)

POST  https://collxxxxxxxxxxxxxxxxxxxxin/api/AOPay/Reseller/V1/SetupSubscription/Transaction


Initiates a subscription transaction using customer, loan, EMI, and amount details, returning a payment intent URL and order status.

Body Parameters
{
 "RegistrationID":"AOP-****",
 "customerCode":"CUST-****",
 "LoanCode": "LOAN-****",
 "EMINumbers": "EMI-**",
 "Amount": 2500.00
}
Request Parameters
Name Type Mandatory Description
RegistrationID String Yes Aopay-issued reseller/customer registration identifier.
customerCode String Yes Masked customer reference/code
LoanCode String Yes Loan reference/code.
EMINumbers String Yes EMI number(s) associated with this transaction.
Amount Decimal Yes Transaction amount; must be greater than zero and less than 15,000 as coded.
Request Headers
Key Value
Content-Type application/json
Accept application/json
Authorization Handled by Aopay
X-MERCHANT-ID Handled by Aopay
Responses

200

200

Response

200

RESPONSE BODY

object

Response

401

RESPONSE BODY

returnMessage     string

401

401

412

412

Response

412

RESPONSE BODY

returnMessage     string


Did this page help you?     Yes    No

Language
shell Shell
python Python
node Node
c# C#
php PHP

cURL

curl --location 'https://collxxxxxxxxxxxxxxxxxxxxin/api/AOPay/Reseller/V1/SetupSubscription/Transaction' \
--header 'Content-Type: application/json' \
--data  '{
   "RegistrationID": "AOP-****", 
   "customerCode": "CUST-****", 
   "LoanCode": "LOAN-****", 
   "EMINumbers": "EMI-**", 
   "Amount": 2500.00
}'
                                
import requests
import json

url = 'https://collxxxxxxxxxxxxxxxxxxxxin/api/AOPay/Reseller/V1/SetupSubscription/Transaction'
payload = json.dumps({
   "RegistrationID": "AOP-****", 
   "customerCode": "CUST-****", 
   "LoanCode": "LOAN-****", 
   "EMINumbers": "EMI-**", 
   "Amount": 2500.00                          
})

headers = {
  "Content-type" : "application/json"
}

response = requests.request("POST", url, headers=headers, data=payload)

print (response.text)
                                
var requests = require("request");
var options = { 
  "method" : "POST",
  "url" : 'https://collxxxxxxxxxxxxxxxxxxxxin/api/AOPay/Reseller/V1/SetupSubscription/Transaction',
  "headers" : {
    "Content-Type" : 'application/json'
  },
  body: JSON.stringify({
   "RegistrationID": "AOP-****", 
   "customerCode": "CUST-****", 
   "LoanCode": "LOAN-****", 
   "EMINumbers": "EMI-**", 
   "Amount": 2500.00
  }) 
}; 
request(options, function(error, response){
   if(error) throw new Error(error);
   console.log(response.body); 
}); 
                                
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post,'https://collxxxxxxxxxxxxxxxxxxxxin/api/AOPay/Reseller/V1/SetupSubscription/Transaction')
var content = new StringContent(
  "{
   "RegistrationID": "AOP-****", 
   "customerCode": "CUST-****", 
   "LoanCode": "LOAN-****", 
   "EMINumbers": "EMI-**", 
   "Amount": 2500.00
  }",
  null,"application/json"
); 

request.Content = content;
var response =  await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
                                
<?php
$curl =  curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL =>  'https://collxxxxxxxxxxxxxxxxxxxxin/api/AOPay/Reseller/V1/SetupSubscription/Transaction',
  CURLOPT_RETURNTRANSFER =>  true,
  CURLOPT_ENCODING =>  '',
  CURLOPT_MAXREDIRS =>  "10",
  CURLOPT_TIMEOUT =>  0,
  CURLOPT_FOLLOWLOCATION =>  true,
  CURLOPT_HTTP_VERSION =>  CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST =>  'POST',
  CURLOPT_POSTFIELDS =>  '{
   "RegistrationID": "AOP-****", 
   "customerCode": "CUST-****", 
   "LoanCode": "LOAN-****", 
   "EMINumbers": "EMI-**", 
   "Amount": 2500.00
  }',
  CURLOPT_HTTPHEADER =>  array(
    'Content-Type: application/json'
  ),
));
$response =  curl_exec($curl);
curl_close($curl);
echo $response;
                                

RESPONSE

200

401

412

-Result

Example

{
    "status": "PENDING",
    "IntentUrl": "https://…",
    "OrderID": "MASKED_Aopay_ORDER_ID",
    "ExpiryAt": "300",
    "MarchentOrderID": "AOP-****_CUST-****_LOAN-****_********",
    "code": "200"                                 
}


 
 
{
    "returnMessage": "Unauthorized access. Please log in again."
}
                                
 
{
   "returnMessage": "Invalid registration ID"
}

                                
 
{
   "returnMessage": "Precondition failed. Please try again."
}