setupPayPal

setupPayPal (PayPalConfig)

This method renders the PayPal Button in the specified HTML DOM element. This method can be used for 2 flows:

  1. Create a PayPal Order (capture or authorization). Refer to PayPalPaymentObject.
  2. Create a PayPal Billing Agreement (subscription). Refer to PayPalPaymentObject.
var fz = new FatZebra({
  username: MERCHANT_USERNAME,
})

fz.on("fz.paypal.success", function(event) {
  console.log(event.detail.data)
})

fz.on("fz.paypal.error", function(event) {
  console.log(event.detail.errors)
})

const paymentObject = {
  paymentIntent: {...},
  paymentMethod: {...}
}

// This method should be called after setting event listeners above!
fz.setupPayPal({
  currency: "AUD",
  payment: paymentObject,
  containerId: "paypal-button-container",
  style: {
    layout: "vertical",
    color: "blue",
    shape: "rect",
    label: "paypal"
  }
})