@toolkitx/paypal
npm i @toolkitx/paypal

@toolkitx/paypal

a wrapper for PayPal REST API

by toolkitx

0.0.3 (see all)License:MITTypeScript:Not FoundCategories:Vanilla JavaScript PayPal API
npm i @toolkitx/paypal
Readme

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

Downloads/wk

10

GitHub Stars

0

LAST COMMIT

1yr ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
0.0.3
latest
1yr ago
No tutorials found
Add a tutorial