eWAY is the easiest way to accept payments in your app or on your website. Get integrated and start selling more, faster - in a range of languages using the eWAY SDKs, helpful documentation, and 24/7 support from real humans. eWAY - with you every step of the way.
Accept payments quickly and easily with eWAY and Node.js using the eWAY Rapid Node.js SDK. Using the eWAY Node.js SDK provides convenient access to all the features of eWAY’s Rapid API, so you can create transactions, process refunds, query transactions, create token customers, and more!
RequirementsThe eWAY Node.js SDK requires Node version 0.10 and requires bluebird, express-uri-template, lodash and request-promise. We recommend installing using the npm package manager to install it.
To make development and testing with eWAY easy, get a free partner account which provides access to the eWAY Sandbox.
InstallUsing npm, the eWAY Node.js SDK can be installed with the following command:
BuildOnce installed, the eWAY Node.js SDK can be included in your project by requiring it:
Now you are all set to build your eWAY integration! You can find code samples for integrating various eWAY functions as part of the eWAY Rapid API reference.
To demonstrate adding the eWAY Node.js SDK, this example will show how to accept a payment with the Responsive Shared Page.
1. Add the eWAY Node.js SDK
In the project directory, run the npm command to install the eWAY Node.js SDK
Once completed, the SDK and its dependencies will be downloaded and added to your project’s node_modules directory.
2. Load the eWAY Node.js SDK
Now the eWAY client can be created with your Rapid API key & password. These can be found in Sandbox or Live MYeWAY – remember that different credentials are needed for sandbox to production.
3. Create a Shared Payment URL
In order to send a customer to the Responsive Shared Page, a URL must be generated using the createTransaction function. This accepts a JSON object – more details of the variables that can be passed can be found in the Rapid API reference.
4. Redirect the Customer
Usually once the shared page URL has been created, the customer can be immediately redirected. Alternatively, you can display the URL (how this is displayed will depend on your Node.js framework):
Now a link will be displayed which goes to the Responsive Shared Page created with the details submitted in the previous step.
5. Fetch the Result
Once the customer has gone to the Responsive Shared Page and submitted their payment information, they will be redirected back to the RedirectUrl specified in the request. This page should use the AccessCode (passed as a query variable) to fetch the result of the transaction.
That’s it – a complete Responsive Shared Page integration!
For more information on the functions available in the eWAY Node.js SDK, check out the eWAY Rapid API Reference.