> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fedapay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Node.js SDK

**The FedaPay Node.js library** simplifies payment management for server-side JavaScript applications, making it ideal for REST APIs and Node.js projects.

### Installation

***Use npm to install the library :***

```javascript theme={null}
npm install fedapay --save
```

### Use Case

#### example of creating a customer

```javascript theme={null}
const { FedaPay, Customer } = require('fedapay');
/* Replace YOUR_SECRETE_API_KEY with your real API key */
FedaPay.setApiKey("YOUR_SECRETE_API_KEY");
/* Specify whether you want to run your query in test or live mode */
FedaPay.setEnvironment('sandbox'); //or setEnvironment('live');
/* Create customer */
const customer = await Customer.create({
  firstname: 'John',
  lastname: 'Doe',
  email: 'john@doe.com',
  phone_number: {
	number: '90090909',
	country: 'BJ'
  }
});
```

#### example of creating a transaction

```javascript theme={null}
const { FedaPay, Transaction } = require('fedapay');
FedaPay.setApiKey('YOUR_SECRET_API_KEY');
FedaPay.setEnvironment('sandbox');
const transaction = await Transaction.create({
  description: 'Payment for order #1234',
  amount: 1000,
  currency: { iso: 'XOF' },
  callback_url: 'https://example.com/callback',
  mode: 'mtn_open',
  customer: { id: 1 }
});
```

<Note>
  To go further with Node.js integration, explore the following resources:

  Official GitHub repository : [fedapay-node](https://github.com/FedaPay/fedapay-node)

  API Reference : [api-reference](https://docs.fedapay.com/api-reference/introduction)

  Demo app source code : [node-sample](https://github.com/fedapay-samples/sample-node)

  Live Demo : [nodesample](https://nodesample.fedapay.com)

  These resources provide a solid foundation for integrating FedaPay into your Node.js projects, with ready-to-use code examples.
</Note>
