sp-easyapi
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

EasyAPI

const pay = new PayPal({
  clientId: "your_client_id",
  secret: "your_secret",
  mode: "sandbox",
  returnUrl: "https://your-return-url.com",
  cancelUrl: "https://your-cancel-url.com",
});

pay.createPayment(
  { amount: "10.00", currency: "USD", description: "Payment for item" },
  (error, payment) => {
    if (error) {
      console.error(error);
    } else {
      pay.getApprovalUrl(payment.id, (error, approvalUrl) => {
        if (error) {
          console.error(error);
        } else {
          console.log(approvalUrl);
        }
      });
    }
  }
);

pay.executePayment(paymentId, payerId, (error, payment) => {
  if (error) {
    console.error(error);
  } else {
    console.log(payment);
  }
});

Readme

Keywords

none

Package Sidebar

Install

npm i sp-easyapi

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

55.3 kB

Total Files

6

Last publish

Collaborators

  • swyftpain