Pay3 Javascript SDK

Callback URL

4min

Introduction

The application can call transaction functions using an optional parameter called callbackUrl. Once this parameter is set Pay3 payment modal will redirect the user to this URL with in couple of seconds after transaction is complete. Pay3 payment modal also added an additional parameter data as a query parameter so that your user can be shown the transaction result within this page.

This works well with the mode=redirect or mode=returnUrl where Pay3 will not be able to send Javascript events to the starting page.

Example

JS


Payment Results

Payment results are added to the callbackUrl using a parameter data. The value of the parameter is a base64 encoded, JSON string of the result.

Sample code to decode the data payload

JS


Payload

  1. data (Type Object): Following keys are present in this object
    1. status (Type string): The status can have one of these values - SUCCESS or ERROR or INITIATED.
    2. message (Type string): User-friendly message returned after completion of the transaction.
    3. orderId (Type string): Pay3 Order ID.
    4. requestId (Type string): Unique ID passed by Application

Whitelisting of Callback URL

The domain of the callback URL needs to be whitelisted for the clientId. Please reach out to support if you see following error. The domain needs to be whitelisted. According to the above example https://your-whitelisted-url.com needs to be whitelisted.



Image of domain not whitelisted error
Domain not whitelisted error