@toolkitx/paypal
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

@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);

Readme

Keywords

none

Package Sidebar

Install

npm i @toolkitx/paypal

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

13.1 kB

Total Files

13

Last publish

Collaborators

  • hwangzhiming