tronWidget objectThere is a single tronPayWidget object and everything resides within it, variables and functions. There are also a number of settings within, followed by the functions themselves.
- approvalConfirmsNeeded [int], default: 0
The number here indicates how many transaction blocks must pass since full payment recognised under the payment address before confirming transaction success. approvalOnRecognition must be false to be effective.
- approvalOnRecognition [bool], default: true
When full payment is received, the transaction is considered successful if this setting is true. If it is false, a transaction is deemed successful when full payment is made and the number of confirms is reached, as per above setting.
- buttonType [string], default: "buy"
Indicates the type of button being used, either "buy" or "donate".
- chargeAmount [decimal], default: 0.00
The amount being charged in this transaction in $TRX
- currencies [array]
The list of currencies as currency codes.
- data [array]
The data you set when implementing TronPay on your site.
- fiatEquivalentDisplay [string]
The amount being paid in the currency the merchant set initially, or user has set using the links in payment screen.
- fiatRates [array]
The exchange rate of 1 TRX against fiat currencies.
- id [string], default: "tron_pay_widget"
The value of the id attribute on the <script> DOM element.
- logo [string]
Contains the SVG of the Tron logo.
- newAddressEndpoint [string], default "https://tronpay.services/get-address"
The API endpoint which the widget will call upon to get a new $TRX address for the merchant.
- numConfirms [int], default 0
The number of blocks that have passed since transaction payment made.
- paidEnought [bool], default false
The indicator of whether the user has paid enough on this transaction to be considered a successful transaction.
- scriptHost [string], default "widget.tronpay.services"
The host on which this widget.js resides.
- serverNotifyEndpoint [string], default "https://api.tronpay.services/save-confirmation"
The API endpoint where reporting data is logged upon payment success or failure.
- showPaymentScreenLockOn [bool], default false
Indicates if the payment screen is being shown.
- transactionRef [string]
The unique transaction reference the merchant may store regarding the transaction.
- trxURI [JSON]
JSON object containing the 5 items used in QR code for making payment - "amount", "data", "tokenName", "tokenId" and "address".
- version [string]
Version identifier for the widget.js being used.
- widget [object]
The DOM element of the widget button being shown.
Copy the generated address to users clipboard.
Displays the help screen for merchant use.
Displays the pament screen.
Generate a the QR code according to the JSON data you pass in.
Calling this with a currency symbol will update the payment display to show the fiat equivalent of the $TRX amount in the currency requested.
Return tech info re the TRONPay widget, the merchant setup and users browser.
Slides the payment screen out of view and fades back to website underneath.
The function you set to define what happens in the event of a payment failure. data contains reason and status codes regarding the failure.
The function you set to define what happens in the event of a payment success. data contains successful transaction data to make use of.
Sets anytime its requested the JSON within trxURI the 5 JSON keys & values - "amount", "data", "tokenName", "tokenId" and "address" for use in QR code.
The "vis" parameter can be "show" or "hide" to expand or contract the currency options in the payment display.
Switches the payment display to display the merchant support screen instead.
fades the partly transparent black overlay into view and slides the payment screen into view.