0.3.4 • Published 3 years ago
bluesnap v0.3.4
bluesnap-node
A node sdk for the BlueSnap API. Built with TypeScript definitions.
Developing
npm installCopy your sandbox username & password into a config/test.yml file in order to be able to run the tests.
Getting Started
Installation
npm i --save bluesnapQuick Start
With Typescript
import { BlueSnapGateway, BlueSnapConfig } from 'bluesnap';
const bluesnapConfig = new BlueSnapConfig('Sandbox', 'username', 'password', '3.0');
const gateway = new BlueSnapGateway(bluesnapConfig);Without Typescript
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
});Api Examples
Create Shopper
const shopper = await gateway.shopper.create({
// Vaulted Shopper Request Object
});Post Card Transaction
const cardTransaction = await gateway.transaction.card.create({
// Card Transaction Request Object
});Post Alt Transaction (PayPal)
const paypalTransaction = await gateway.transaction.paypal.get('orderId'); // PayPal Order IdRefund
await gateway.refund.refund('transactionId'); // The Transaction IdGet a Wallet
const wallet = await gateway.wallet.get('walletId'); // Wallet IdMore Examples
For more examples check out tests located in the test directory.