Javascript widget integration

How to integrate IremboPay v2.0 into your website and web applications

1

Add the Irembopay CDN

<script src="https://dashboard.sandbox.irembopay.com/assets/payment/inline.js"></script>

2

Add the function to trigger your payment request

<script>
   function makePayment() {
       IremboPay.initiate({
           publicKey: "xxx",
           invoiceNumber: "xxx",
           locale: IremboPay.locale.EN,
           callback: (err, resp) => {
               if (!err) {
                   // Perform actions on success
                   // IremboPay.closeModal();
               } else {
                   // Perform actions on error
               }
           }
       })
   }
 </script>
3

Call the function where you need it

<button onclick="makePayment()">Pay</button>

Specific error scenarios

  • Public key is not valid

{
  "message": "Invalid request",
  "success": false,
  "errors": [
    {
      "code": "INVALID_KEY",
      "detail": "Public key is not valid"
    }
  ]
}
  • Invoice not found

{
  "message": "Invalid request",
  "success": false,
  "errors": [
    {
      "code": "INVOICE_NOT_FOUND",
      "detail": "Invoice not found"
    }
  ]
}
  • Invoice has already been paid

  • Invoice has expired

  • Invoice is already linked to a Batch Invoice

  • No invoice provided

  • The locale value is not valid

Last updated