Create an account in less than 5 minutes! Sign up now »


A blog for entrepreneurs, innovators and changemakers to learn, scale and grow.

Xendit Node.js Library

Engineers at Xendit are seeing an increasing amount of traffic coming from Node.js applications and had a bunch of requests for an official Node client. Well guess what, we’ve heard you! Making integration seamless and as close to “effortless” is one of our top priorities at Xendit

Throughout December, we built a new Node.js library to add to our already existing PHP and Java libraries. This new Node.js library covers all of our products’ APIs.

Node.js logo

Installing our Node.js library is simple and easy

Install our Node.js library by using npm and run `npm install xendit-node` on your machine. 

Once you have successfully installed the library, you will need to sign up for a Xendit account to gain access to the Xendit dashboard and to obtain API keys and start processing payments using Node.js library. 

Refer to Xendit API Reference for complete integration guide including API parameters, status code, error message, callback setup, and go-live checklists.

Our Node.js client library handles all the heavy-lifting for you so the only thing you need to worry about is how Xendit falls into your business process rather than the nitty-gritty integration details. Our Node.js client library removes all non-business-domain concerns from your code like encoding etc., and effectively turns a snippet full of distracting peripheral matters into a much more concise and readable piece of code with full focus on your business domain.


```jsconst fetch = require(‘node-fetch’);
fetch(‘’, {  method: ‘POST’,  headers: {    ‘Content-Type’: ‘application/json’,    Authorization: `Basic ${Buffer.from(‘YOUR_SECRET_KEY:’).toString(‘base64’),  },  body: JSON.stringify({    external_id: ‘your-external-id’,    payer_email: ‘’,    amount: 100000  })```


```jsconst { Invoice } = required(‘xendit-node’)({ secretKey: ‘YOUR_SECRET_KEY’ })const invoiceClient = new Invoice();invoiceClient.createInvoice({  externalID: ‘your-external-id’,  payerEmail: ‘’,  amount: 100000})```

We also open-source our Node.js library on Github. Feel free to contribute or raise any requests, bugs or comments by opening an Github issue or submitting a pull request.

We are continuously developing more libraries/SDKs, let us know of any others that can help you integrate with Xendit more seamlessly. You can also check out our existing libraries; PHP and Java to help you integrate with us. If you have implemented your own library or have an example that you would like to share with us, send us a link to your code and we will be happy to add it to the list in our documentation!

Learn more about payments in Indonesia

Understanding the opportunities and challenges of the local market is key to staging an effective entrance.

Related posts