Below we take you through the setup the most common uses, as seen on the Demos page...
With your website code editor open, head over to your Account, copy the ready made code for you and paste it into your code editor.
The code we provide contains all you need to get the button and all interaction on your website and the parameters are set to use your account. Let's look at those parameters now...
"id" : "tron_pay_widget", // The id of the <script> tag that loads TRONPay and also where it places the button "merchant_ref" : "XG9T4-P3EN9", // Unique merchant reference just for you so we can make sure all payments go to you "amount" : 5, // The amount the user will pay of the currency "currency" : "USD" // The currency the user pays in "description" : "food bill" // A short description, appears in your account under reports sectionSo nice and simple so far. There are more options you can provide, detailed in the API section, but the above (with the exception of description) are all you need to specify regarding parameters.
Of course we want to define what to do when a successful or failed transaction attempt is made. The code we provide also contains the functions to handle what to do on successful payment.
You may for instance want to put window.location = "/thank-you'; into the function that handles payment success and alert("Sorry, payment failed, please try again"); into the failure function.
Request payment linkYou may not want to put a button in your site of course, you may just want a link which, when visited, shows the payment screen immediately.
You can create a website link containing the same parameters you'd use in the widget code. So, if you'd like to request the 5 USD for "food bill", you provide that info and your merchant ref, then we handle the rest...