By using the configuration you can change the following:
- Header
- Footer
- Theme
- Brand Logo
- Payment Option ordering/filtering
let defaultMerchantConfiguration = {
"root": "",
"style": {
"bodyColor": "",
"themeBackgroundColor": "",
"themeColor": "",
"headerBackgroundColor": "",
"headerColor": "",
"errorColor": "",
"successColor": ""
},
"flow": "DEFAULT",
"data": {
"orderId": "",
"token": "",
"tokenType": "TXN_TOKEN",
"amount": "",
"userDetail": {
"mobileNumber": "",
"name": ""
}
},
"merchant": {
"mid": "",
"name": "",
"redirect": true
},
"labels": "DEFAULT",
"payMode": {
"labels": {},
"filter": [],
"order": []
},
"handler": {}
};
Configuration Details
You can make the configuration on the runtime as per the window.Paytm.CheckoutJS.init.
Following are the details for customization parameters:
Attribute | Purpose | Type | Default | Example |
---|---|---|---|---|
root | The DOM element to be mounted on initialization. It can be a CSS selector string or an actual HTMLElement. | String | HTMLElement | #paytm-checkoutjs |
|
flow | Type of JS Checkout integration. It will be DEFAULT. | String | DEFAULT |
|
labels | Change the label text of paymodes | Object | {} |
|
style:
Description: Style the layout of the payment page. Merchant can customize the header, body and theme of the page.
Type: Object
Default: {}
NOTE
Color code should be in hexadecimal values.
Attribute | Purpose | Type | Example |
---|---|---|---|
themeBackgroundColor | Primary color of the theme i.e. background color of HTML elements such as button, radio button and checkbox. | String |
|
themeColor | Secondary color of the theme i.e. text color of HTML elements such as button, radio button & checkbox | String |
|
headerBackgroundColor | Primary/background color of header and footer. | String |
|
headerColor | Secondary color of the header and footer i.e. text color of content in header and footer. | String |
|
data:
Description: Configure transaction-related data of each request.
Type: Object
window.Paytm.CheckoutJS.init({
"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);
}
}
});
NOTE
orderId, amount,token, and tokenType are mandatory fields on the data object.
Attribute | Purpose | Type | Note | Example |
---|---|---|---|---|
orderId | Order ID | String(50) | Special Characters allowed in Order ID are: “@” “-” “_” “.” |
|
amount | Transaction amount | String | Number |
Must contain upto two decimal points. The amount should not include any separator like (“,”) |
|
token | Transaction token received from calling Initiate Transaction API. | String | If token is present then tokenType field is mandatory |
|
tokenType |
Type of token for doing transaction
|
String |
Token field is a prerequisite. |
|
merchant:
Description: Configure merchant related properties
Type: Object
Attribute | Purpose | Type | Default Values | Example |
---|---|---|---|---|
name | Change merchant name | String |
|
|
redirect | Handling of payment response after successful transaction | Boolean |
True Note: If redirect field is false then transactionStatus callback in part of configuration is mandatory. |
|
payMode:
Description: List of supported payment options. Customize order, filter and labels for payment options render on the page using payMode's value.
Type: Object