Paypal is an international payment gateway provider where you can send and receive your money with multiple currencies. commission rates will be different based on their countries

Prerequisites

Paypal Integration requires an account with PayPal. you can create new PayPal account for free

Initialising PayPal

document.addEventListener("deviceready", onDeviceReady);
function onDeviceReady() {
 var clientIDs = {
 "PayPalEnvironmentProduction": "YOUR_PRODUCTION_KEY", // not needed while testing
 "PayPalEnvironmentSandbox": "YOUR_SANDBOX_KEY"
 };

function onPayPalMobileInit() {
  PayPalMobile.prepareToRender(
   "PayPalEnvironmentSandbox", // or "PayPalEnvironmentProduction" 
   new PayPalConfiguration({
     merchantName: "Shop Name",
     acceptCreditCards: true,
     merchantPrivacyPolicyURL: "https://shopname.com/policy",
     merchantUserAgreementURL: "https://shopname.com/agreement"
   }),
 function() {
   console.log("OK, ready to accept payments!")
 });
}
 PayPalMobile.init(clientIDs, onPayPalMobileInit);
}

Receiving Payment

function payNow() {
  var paymentDetails = new PayPalPaymentDetails("15.00","3.00","2.00");
  //new PayPalPayment Details("subtotal","shipping","tax");
  //PayPalPalment("total","currency in ISO 4217 format","Description","Sale",object);
  var payment = new PayPalPayment("20.00","USD","PhoneGapPro T-Shirt","Sale",paymentDetails);

  PayPalMobile.renderSinglePaymentUI(payment,
   function(payment) {
     alert("payment success: " + JSON.stringify(payment));
   },
   function(error) {
     alert(error);
   });
}

PayPalMobile.renderSinglePaymentUI() will invoke payment UI for receiving money.

Sundaravel M

About the author: Hi! I'm Sundaravel (codesundar), Founder of codesundar.com. I have been a Web, Mobile App developer, Author, and Teacher since 2014. I also worked as a software consultant for fortune 500 companies. I created codesundar.com to share my real-time knowledge in various technologies such as PhoneGap, Ionic, Flutter and more.