0.0.3 • Published 3 years ago

@toolkitx/paypal v0.0.3

Weekly downloads
53
License
MIT
Repository
github
Last release
3 years ago

@toolkitx/paypal

Test npm version npm downloads

Installing

Using npm

npm install @toolkitx/paypal

Example

Get instance

import {Paypal, PayPalEnvironment} from '@toolkitx/paypal';

const conf = new PayPalEnvironment('CLIENT_ID', 'CLIENT_SECRET', 'Sandbox|Live', 'v1');
const paypal = new Paypal(conf);

Chain

paypal
.api('URL')
.head(key, value)
.query({key: 'value'})
.get()
// or .post(payload)
  • Get products
const products: PaypalPageResponse = await paypal.products().get();
  • Get single product
const product = await paypal.products('Product id').get();
  • Query products
const v = await paypal.products().query({param1: 'EXAMPLE'}).get();
  • Plan actions

Support activate/deactivate/updatePricingSchemes plans

await payPal.plans(testPlanId).activate().post();
  • Subscription actions

Support activate/cancel/suspend subscription

await payPal.subscriptions('id').suspend().post({
    "reason": "suspend reason"
});

Custom Request

await paypal.api('RELATE_URL').get();
await paypal.api('RELATE_URL').post(payload);
0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago