Add payment form

To add the payment form into your website:

1

Add the div provided to you into your code to contain the payment form.

<div id="payment-form"></div>
2

Add the script tag into the JavaScript SDK library.

<script src="https://gateway-sb.clearent.net/js-sdk/js/clearent-host.js"></script> code
3

Add the Global Callback Handlers into your code to receive the success or error messages from the JavaScript SDK. You can also add the Promises to receive the success or error messages alternate to avoid global callback handlers.

<script type="text/javascript">
    // When you get a successful token response and
    // use this to make a sale/auth on your backend
    function ClearentTokenSuccess(raw, json) {
        console.log("ClearentTokenSuccess");
        console.log(raw);
        console.log(json);
        // now you can send the token to your server
        // to complete the transaction via mobile-gateway
    }
    function ClearentTokenError(raw, json) {
        console.log("ClearentTokenError");
        console.log(raw);
        console.log(json);
    }
</script>java
4

Call the init method using the baseUrl and pk provided to you for your sandbox.

<script type="text/javascript">
    ClearentSDK.init({
        "baseUrl": "https://gateway-sb.clearent.net",
        "pk": "YOUR PUBLIC KEY GOES HERE"
    });
</script>

This form lets your customers submit their payment information.

Last updated

Was this helpful?