Integrate NodeJS and Commercegate

Trexle connects NodeJS to Commercegate and 100+ other payment gateways using a single plugin for one time annual fee

Commercegate and NodeJS Integration Guide

Complete all the information requested and click the Submit button.  Your information will be sent
to a CommerceGate account representative you will review the information and confirm you for a
CommerceGate account.  You will then receive an email containing your site username (which is
also your customer ID) and a temporary password. The email will also contain the link to the
CommerceGate Back Office.

It is important to record your customer ID number.  This number is used as a base for the login to
the CommerceGate system.  You should include your customer ID number on all communications
with CommerceGate. After that the callback url need to be set.

Take the credentials you just obtained from Commercegate and navigate to Trexle dashboard, click Payments Gateways and select Commercegate from the drop down menu as shown below.

Fill into your Commercegate credential and click Add Gateway. Click the Activate button next to Commercegate, and it will give you a success message and the button will turn into green. You should see something like below.

To integrate Commercegate and NodeJS you need Trexle API keys

In your NodeJS project, open a terminal and issue the following command:

npm install trexlejs

If you want to test, consider writing the following example in a test.js file:

var Trexle = require('trexlejs');

var trexle = Trexle.setup({
key: ‘your-api-key’,
production: false

amount: 400,
currency: ‘usd’,
description: ‘test charge’,
email: ‘[email protected]’,
ip_address: ‘’,
card: {
number: ‘4242424242424242’,
expiry_month: 8,
expiry_year: 2018,
cvc: 123,
name: ‘John Milwood’,
address_line1: ‘423 Shoreline Park’,
address_city: ‘Mountain View’,
address_postcode: 94043,
address_state: ‘CA’,
address_country: ‘US’
}, function (response) {

Then run the code:

node test.js

Testing Credit Cards
To test credit card transactions and callbacks properly, you need to get in touch with CommerceGate support and get some test card for testing of CommerceGate.
On your test server, follow the links to the payment page (ccform.php).
Keep in mind to
•Use a different email address for each test to prevent conflicts
•For the user’s name, use any string (it does not have to be unique)
•For the credit card number, use a different number for each test (using the same number will cause a conflict)
•For the CVV, use any three digits
•For expiration dates, ensure they are later than the current month and year (or the transaction will be rejected prior to processing)
•Complete each test in a different browser session (close the browser and start it again to prevent issues with the browser cache)
If the credit card test is processed successfully, a SUCCESS callback will be generated. You can also see each transaction attempted in the Back Office, under Statistics. This will show you all information about the transaction.
After verifying the test transaction, cancel it in your Back Office to avoid rebills.
Note: Try to avoid making a lot of tests in short succession.  If many similar transactions
are received from the same IP, the Commerce Gate automatic fraud system or the bank system may become suspicious and block further transactions.  If the bank blocks your IP, it can take some time to unblock it.  This blocking can occur even with test cards in test mode

Commercegate Supported Countries

Commercegate Supported Payment Processing Actions

✖ Purchase
✖ Authorize
✖ Capture
✖ Void
✖ Credit
✖ Recurring
✖ Card Store

Key Features

Credit Card Vault: securely store your customers sensitive credit card data using tokens.
Instant PCI-DSS Compliance: your customers credit card data never touches your site or server.
Multiple Gateway Support: Connect your NodeJS site to 100+ payment gateway

About Trexle

Trexle is a powerful online recurring subscription billing platform that integrate Commercegate and other +100 payment gateways with NodeJS and other dozen of e-commerce platforms.

About Commercegate

Their innovative processing technology offers powerful features and options that can be tailored to fit your particular business model and drive your revenue. Deploy their agile payment pages to suit any platform, ensuring maximum throughput and security while your customers enjoy a fast and smooth purchase experience. Or use their APIs to create your own ways to access business critical data and create extra functionality exactly as you want it. To make it work your way; that is the CommerceGate way.

About NodeJS

Node.js is an open-source, cross-platform JavaScript runtime environment for executing JavaScript code server-side, and uses the Chrome V8 JavaScript engine. Historically, JavaScript was used primarily for client-side scripting, in which scripts written in JavaScript are embedded in a webpage's HTML, to be run client-side by a JavaScript engine in the user's web browser. Node.js enables JavaScript to be used for server-side scripting, and runs scripts server-side to produce dynamic web page content before the page is sent to the user's web browser.