search
Casual T-Shirt

Casual T Shirt

★★★★☆4/5

Amount

Rs 1

Color

Blue

Paytm JS Checkout gives your customers a fast and secure way to complete payments. The checkout experience is optimized for mobile and desktop performance. It can be integrated easily with any website with pre-defined code snippets provided by Paytm.

This is a real transaction and money will be debited from your account, and the money will be auto-refunded to your account.

To integrate JS checkout with your website, refer here.

JS Checkout Integration Steps

  1. Step 1: Initiate Payment

    Follow the official Initiate Payment guide here.

  2. Step 2: Add Code Snippet

    Follow the official invoke-payment guide here.

    Code Snippet
    <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 JS Checkout
    window.Paytm.CheckoutJS.invoke();
    }).catch(function onError(error){
    console.log("error => ",error);
    });
    });
    }
    }
    </script>
  3. Step 3: Verify Payment Result

    After checkout completes, verify transaction outcome by following the official guide here.