bluesnap
Version:
Node SDK for the BlueSnap Payment Gateway
73 lines (56 loc) • 1.57 kB
Markdown
A node sdk for the [BlueSnap API](https://developers.bluesnap.com/v8976-JSON/docs). Built with TypeScript definitions.
```
npm install
```
Copy your sandbox username & password into a `config/test.yml` file in order to be able to run the tests.
```
npm i --save bluesnap
```
```
import { BlueSnapGateway, BlueSnapConfig } from 'bluesnap';
const bluesnapConfig = new BlueSnapConfig('Sandbox', 'username', 'password', '3.0');
const gateway = new BlueSnapGateway(bluesnapConfig);
```
```
const bluesnap = require('bluesnap');
const gateway = new bluesnap.BlueSnapGateway({
environment: 'Sandbox', // 'Production' or 'Sandbox'
username: 'smrubin', // BlueSnap username
password: 'password', // BlueSnap password
apiVersion: '3.0', // Optional
});
```
```
const shopper = await gateway.shopper.create({
// Vaulted Shopper Request Object
});
```
```
const cardTransaction = await gateway.transaction.card.create({
// Card Transaction Request Object
});
```
```
const paypalTransaction = await gateway.transaction.paypal.get('orderId'); // PayPal Order Id
```
```
await gateway.refund.refund('transactionId'); // The Transaction Id
```
```
const wallet = await gateway.wallet.get('walletId'); // Wallet Id
```
For more examples check out tests located in the `test` directory.