1 | # BlueSnap API Wrapper (Node.js)
|
2 |
|
3 | [![npm version](https://badge.fury.io/js/bluesnap-api.svg)](https://badge.fury.io/js/bluesnap-api) [![install size](https://packagephobia.now.sh/badge?p=bluesnap-api)](https://packagephobia.now.sh/result?p=bluesnap-api)
|
4 |
|
5 | This wrapper library gives access to the API of the global payment gateway - BlueSnap.
|
6 |
|
7 | ## Quick start
|
8 |
|
9 | ```bash
|
10 | npm install bluesnap-api
|
11 | ```
|
12 |
|
13 | ```js
|
14 | const BlueSnap = require('bluesnap-api');
|
15 |
|
16 | (async () => {
|
17 |
|
18 | // Initialize BlueSnap gateway.
|
19 | const bsg = BlueSnap({username: 'myusername', password: 'mypassword'});
|
20 |
|
21 | // Create vendor.
|
22 | const vendorId = await bsg.vendors.create({email: 'vendor@example.com', country: 'RU'});
|
23 |
|
24 | console.log('Vendor ID:', vendorId); // Vendor ID: 19575974
|
25 |
|
26 | })();
|
27 | ```
|
28 |
|
29 | Constructor accepts one parameter - configuration object with following properties:
|
30 | - `username` {String} - username to use for authorization (from API Credentials).
|
31 | - `password` {String} - password to use for authorization (from API Credentials).
|
32 | - `isSandbox` {Boolean} (optional) - whether to use Sandbox or Production environment. Default: `true`.
|
33 | - `version` {String} (optional) - BlueSnap API version to use.
|
34 |
|
35 | ## API
|
36 |
|
37 | ### Transactions (incl. Refunds)
|
38 |
|
39 | #### transactions
|
40 |
|
41 | - `authCapture` - authorize and capture transaction.
|
42 | - `authOnly` - only authorize transaction.
|
43 | - `capture` - capture authorized transaction.
|
44 | - `authReversal` - reversed authorized uncaptured transaction.
|
45 | - `get` - retrieve transaction.
|
46 | - `refund` - partially/fully refund captured transaction.
|
47 |
|
48 | ### Vaulted Shoppers
|
49 |
|
50 | #### vaultedShoppers
|
51 |
|
52 | - `create` - create vaulted shopper.
|
53 | - `update` - update vaulted shopper.
|
54 | - `get` - retrieve vaulted shopper.
|
55 |
|
56 | ### Subscriptions
|
57 |
|
58 | #### plans
|
59 |
|
60 | - `create` - create subscription billing plan.
|
61 | - `update` - update subscription billing plan.
|
62 | - `get` - retrieve subscription billing plan.
|
63 | - `list` - list all subscription billing plans.
|
64 |
|
65 | #### subscriptions
|
66 |
|
67 | - `create` - create subscription.
|
68 | - `update` - update subscription.
|
69 | - `createMerchantManaged` - create merchant-managed subscription.
|
70 | - `createMerchantManagedCharge` - charge merchant-managed subscription.
|
71 | - `get` - retrieve subscription.
|
72 | - `list` - list subscriptions.
|
73 | - `getCharge` - retrieve a specific charge.
|
74 | - `listCharges` - list all charges.
|
75 | - `getSwitchChargeAmount` - retrieve the amount that would be charged to a shopper if you changed the subscription to a different plan or to a different quantity or both.
|
76 |
|
77 | ### Marketplace
|
78 |
|
79 | #### vendors
|
80 |
|
81 | - `create` - create vendor.
|
82 | - `update` - update vendor.
|
83 | - `get` - retrieve vendor.
|
84 | - `list` - list all vendors.
|
85 |
|
86 | ### Wallets
|
87 |
|
88 | #### wallets
|
89 |
|
90 | - `create` - create wallet.
|
91 | - `get` - retrieve wallet.
|
92 | - `visaCheckoutApiKey` - create/retrieve Visa Checkout API key.
|
93 | - `onboardApplePay` - onboard Apple Pay.
|
94 | - `getApplePayOnboardingInfo` - retrieve Apple Pay onboarding info.
|
95 |
|
96 | ### Reporting
|
97 |
|
98 | #### reports
|
99 |
|
100 | - `get` - retrieve report data.
|
101 |
|
102 | ## Documentation
|
103 |
|
104 | ```bash
|
105 | npm run docs # generate docs
|
106 | npm run http-docs # start HTTP server serving docs
|
107 | ```
|
108 |
|
109 | ## Testing
|
110 |
|
111 | ```bash
|
112 | npm test
|
113 | ```
|
114 |
|
115 | ## License
|
116 |
|
117 | [MIT](./LICENSE)
|