This document will show you how to collect payments from your customers using PayChangu inline in a js

Sample inline Implementation

You can embed PayChangu on your page using our PayChanguCheckout() JavaScript function. The function responds to your request in accordance with your request configurations. If you specify a callback_url in your request, the function will redirect your users to the provided callback URL when they complete the payment.

<form>
  <script src="https://in.paychangu.com/js/popup.js"></script>
  <div id="wrapper"></div>
  <button type="button" onClick="makePayment()">Pay Now</button>
  </form>
<script>
    function makePayment(){
      PaychanguCheckout({
        "public_key": "SEC-TEST-OtbJJZgchqInA8mYSfZby8ZS7ff7WD9i",
        "tx_ref": '' + Math.floor((Math.random() * 1000000000) + 1),
        "amount": 1000,
        "currency": "MWK",
        "callback_url": "https://webhook.site/7657863465874",
        "return_url": "https://webhook.site",
        "customer":{
          "email": "[email protected]",
          "first_name":"John",
          "last_name":"Doe",
        },
        "customization": {
          "title": "Test Payment",
          "description": "Payment Description",
          "logo": "https://assets.piedpiper.com/logo.png"
        },
        "meta": {
          "uuid": "uuid",
          "response": "Response"
        }
      });
    }
    </script>

With this, you can go ahead and perform other activities like Transaction verification