Skip to main content

Creating a PayPal component

You can enable this by calling addPaypal():

window.addEventListener('load', function () {
xpanse.init('sandbox', '<public key>')
.addPaypal('iframeContainer', '<amount>', '<3-letters currency code>', '<PayPal Provider Id (optional)>', 'options (optional)');
});

options is an optional object that can contain the following properties:

  • hideShipping: redact the shipping address from the PayPal site
  • paypalButtonStyle: modify the PayPal buttons to change the colour of the button (can be gold, blue, silver, white, black). The default button colour is gold
  • paypalEnablePayIn4: enable PayPal Pay in 4 (can be true or false)
  • transfer: account: the merchant who receives payment for this transaction amount: the total order amount
  • metadata: additional metadata to send with the payment request (optional), sent as key/value pairs (eg metadata : {key1 : 'value1', key2 : 'value2'})