Payment - Web-button

When the consumer either scan a Dynamic Code displayed as QrCode or type the mobile number to complete the payment. Both options are handled by the Web Button that is an embeddable JavaScript that loads the Satispay Payment option on your client

📘

Web-button vs Web-redirect

The Web-button - payment is more suited for integration into websites that are mostly used on desktop computers.
The Web-redirect - payment is more suited for integration into websites that are mostly used on mobile devices as it automatically manages the switch between the mobile-browser and the Satispay app.

APIs required for this flow

🚧

When creating a Payment for the Web-button the callback_url is required.

Sequence diagram

Web-button

Once the payment has been created, the Web-button can be initialised.

Standard

<script
  src="https://online.satispay.com/web-button.js"
  data-payment-id="8f27fbbc-ff4b-45eb-98d0-1cadb3a0afaa"
></script>
<script
  src="https://staging.online.satispay.com/web-button.js"
  data-payment-id="8f27fbbc-ff4b-45eb-98d0-1cadb3a0afaa"
></script>

Advanced

The advanced version of the Web-button allows UX customisation of the payment button.

<script src="https://online.satispay.com/web-button.js"></script>

<img src="https://online.satispay.com/images/en-pay-red.svg" alt="Pay with Satispay" id="pay-with-satispay" style="height: 50px; cursor: pointer;" />

<script>
var satispay = SatispayWebButton.configure({
  paymentId: '8f27fbbc-ff4b-45eb-98d0-1cadb3a0afaa',
  completed: function() {
    // executed on payment success or failure
  }
})

document.getElementById('pay-with-satispay').addEventListener('click', function(e) {
  e.preventDefault()
  satispay.open()
})
</script>
<script src="https://staging.online.satispay.com/web-button.js"></script>

<img src="https://staging.online.satispay.com/images/en-pay-red.svg" alt="Pay with Satispay" id="pay-with-satispay" style="height: 50px; cursor: pointer;" />

<script>
var satispay = SatispayWebButton.configure({
  paymentId: '8f27fbbc-ff4b-45eb-98d0-1cadb3a0afaa',
  completed: function() {
    // executed on payment success or failure
  }
})

document.getElementById('pay-with-satispay').addEventListener('click', function(e) {
  e.preventDefault()
  satispay.open()
})
</script>

SatispayWebButton.configure() can be used to create an instance of web button. Once done then call open() or close() functions in response to any event. The paymentId parameter must be passed to configure() function.

🚧

The script must be loaded directly from https://online.satispay.com/web-button.js. Using a local copy is unsupported, and may result in errors.