• Getting Started
    • Mobile Integration (Android/IOS)
      Enterprise Solutions
      Accept Payments
      Process Payments
      Disbursals
      API References
      Webhooks
      Testing
      Refunds
      Guides
      Other Processes
      Mini Program Platform
        Website Integration

      Code Snippets

      Configuration snippets for easy integration of Blink Checkout.

      A default basic configuration to get started with Blink Checkout. Implement the handler functions body and pass the configuration object into window.Paytm.CheckoutJS.init method.

      Note : update values of root,data.orderId,data.tokendata.tokenTypedata.amount

      let config = {
            "root": "",
            "flow": "DEFAULT",
            "data": {
              "orderId": "", /* update order id */
              "token": "", /* update token value */
              "tokenType": "TXN_TOKEN",
              "amount": "" /* update amount */
            },
          "handler": {
              "notifyMerchant": function(eventName,data){
                console.log("notifyMerchant handler function called");
                console.log("eventName => ",eventName);
                console.log("data => ",data);
              } 
          }
      }

      The JS Snippet, if generated (for first time integration), will be in the following format:

      <script type="application/javascript" src="{HOST}/merchantpgpui/checkoutjs/merchants/{MID}.js" onload="onScriptLoad();" crossorigin="anonymous"></script>
      <script>
        function onScriptLoad(){
            var config = {
              "root": "",
              "flow": "DEFAULT",
              "data": {
                "orderId": "", /* update order id */
                "token": "", /* update token value */
                "tokenType": "TXN_TOKEN",
                "amount": "" /* update amount */
              },
              "handler": {
                "notifyMerchant": function(eventName,data){
                  console.log("notifyMerchant handler function called");
                  console.log("eventName => ",eventName);
                  console.log("data => ",data);
                } 
              }
            };
      
            if(window.Paytm && window.Paytm.CheckoutJS){
                window.Paytm.CheckoutJS.onLoad(function excecuteAfterCompleteLoad() {
                    // initialze configuration using init method 
                    window.Paytm.CheckoutJS.init(config).then(function onSuccess() {
                        // after successfully updating configuration, invoke Blink Checkout
                        window.Paytm.CheckoutJS.invoke();
                    }).catch(function onError(error){
                        console.log("error => ",error);
                    });
                });
            } 
        }
      </script>