Checkout Type — Light


Use light checkout with Instamojo by passing payer name, email & phone in form directly to Instamojo final payment page.

With Light Checkout, the payment form loads faster and takes the payer directly to the final payment page. The payer is taken to the final payment page only if buyer_name, email & phone were supplied during request creation, else the payer will have to fill these details in before paying. - Instamojo Documentation.

checkout_type
Specifies a checkout type to deploy. Available predefined values light, floating, custom & debug.

Usage:


$.fn.mojoReq({

    checkout_type  : 'light'

});

or

$.fn.mojoReq.defaults.checkout_type = 'light';

Example Checkout Form


Create form fields to include payer data & pass to $.fn.mojoReq() function and enable Instamojo light checkout.

    <!-- form with checkout button -->
<form class="unique-form">
    <label>Name</label>
    <input name="buyer_name" type="text"/>
    <label>Email</label>
    <input name="email" type="email"/>
    <label>Phone</label>

    <-- checkout button -->
    <input name="phone" type="text"/>
    <button class="unique-classname" type="button">Pay with Instamojo</button>
</form>

mojoReq(js) Setup: Checkout Type - Light


<script>
// your secret keys (please obfuscate)
$(function(){
    $.fn.mojoReq.defaults.data.api_key    = 'YOUR-API-KEY';
    $.fn.mojoReq.defaults.data.auth_token = 'YOUR-AUTH-TOKEN';
});
</script>
<script>
$(function(){

    // assign 'click' event at form button
    $('.unique-classname').on( 'click' , function( event ){

        // prevents default button behavior
        event.preventDefault();

        // init instamojo checkout
        $(this).mojoReq({

            // required setup
            sandbox      : true,
            data: {
                buyer_name : $('[name=buyer_name]').val(),
                email      : $('[name=email]').val(),
                phone      : $('[name=phone]').val(),
                amount       : '1000.00',
                purpose      : 'Payment description/purpose,
                redirect_url : 'http://your.domain.name/success.html'
            },

            // specifies Instamojo light checkout
            checkout_type: 'light'
 
        });
    });

});
</script>

$.fn.mojoReq() says... buyer_name , email, phone are reserved nested data objects.