How to integrate Authorization.net for payment in nodejs
Posted By : Mayank Tyagi | 26-Jun-2015
In order to integrate payment gateway using Authorization.net we need to install the authorization.net module of node npm install node-authorize-net .To create subscription using authorization.net we need to create account on authorization.net and for testing purpose create sandbox account on developer authorization.net create the Automated Recurring Billing client
var arbClient = arb.client(configurationHolder.config.payment.loginId, configurationHolder.config.payment.loginKey);
arb.useSandbox();//add this when using the testing account
Now, create subscription from following method
use the following JSON to make payment
{"refId": "197s8",
"subscription": {
"name": "plan2",
"order": {
"invoiceNumber": "inv-034989",
"description": "enterprise"
},
"paymentSchedule": {
"interval": {
"length": 1,
"unit": "months"
},
"startDate": "2015-06-25",
"totalOccurrences": "9999",
"trialOccurrences": "1"
},
"amount": "19.99",
"trialAmount": "0",
"payment": {
"creditCard": {
"cardNumber": "4007000000027",
"expirationDate": "2018-12",
"cardCode": "111"
}
},
"billTo": {
"firstName": "Jane",
"lastName": "Doe"
}
}
}
If you get subscription id and refId in the response it means your payment method is working properly for checking the subscription validation use
arbClient.getSubscriptionStatus(request, function (error, response) {
if (error) {
//do something
}
else{
//you will get the status active or inactive
}
I hope you will find this blog useful.
Thanks
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Mayank Tyagi
Mayank is a bright Web Developer with expertise in Java language.