Skip to content

Trying to make complicated API's slightly easier and more readable, less mess in your own code

License

Notifications You must be signed in to change notification settings

SwyftPain/EasyAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Trying to make complicated API's slightly easier and more readable, less mess in your own code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published