Skip to content

vinniegarcia/paypal-incontext-browserify-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PayPal In-Context Browserify Example

An example of a PayPal In-Context checkout integration using browserify and browserify-shim

Getting started

  1. Install browserify and browserify-shim into your project:
npm install browserify browserify-shim --save-dev
  1. In your package.json, add a browserify key containing:
"browserify": {
  "transform": [
    "browserify-shim"
  ]
}

This tells browserify to use the browserify-shim. 3. Add a browserify-shim key to package.json so you can use PayPal In-Context from your bundle:

"browserify-shim": {
  "paypal-incontext": "global:paypal"
}
  1. In your HTML file, add references to PayPal's checkout.js and your bundle.
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<script src="path/to/dist/js/bundle.js"></script>
  1. In your code, use the paypal-incontext module you defined previously:
var paypal = require('paypal-incontext');
paypal.checkout.setup('MERCHANT_ID' {
  options: {}
});
  1. Bundle your code:
browserify -d src/ -o dist/js/bundle.js
  1. Take orders and make money! 💰💳💸

About

example of a PayPal incontext checkout integration using browserify and browserify-shim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published