Opening payment page by clicking a button

You can add a button on your page and have Payment Page opened each time customer clicks the button. To implement this scenario, use the following method:

EPayWidget.bind('<pay_button_id>', configObj, method);

here:

  • <pay_button_id> is the ID of the button that will open Payment Page.
  • configObj is a JavaScript object which contains all the required payment parameters. For the list of all the parameters you can include in the object see Payment Page invocation parameters.
  • method is HTTP request method. This is optional parameter. Supported values are GET (default) and POST.
Here is an example of using button to open Payment Page:
EPayWidget.bind('pay_button_id', 
                { payment_id: 'X03936', // Payment ID
                  payment_amount: 2035, // Payment amount
                  payment_currency: 'USD', // Payment currency
                  project_id: 123, // Project ID
                  signature: 'YWb6Z20ByxpQ30hfTI.....' }, // Signature
                 'post')

In this example, the configObj object code is highlighted in bold and contains payment ID, payment amount, payment currency, project ID, and signature. For more information about signing payments see Signature generation and verification

To set up the size of the page inserted in the iframe, pass the width and height values in the redirect_window_height and redirect_window_width parameters included in the payment_methods_options string in the request or Payment Page opening:

payment_methods_options={"redirect_window_height": 1200, "redirect_window_width": 1200}

To set up the size of the page for the specific payment method selected by a customer, also specify the payment method code:

payment_methods_options={"card": {"redirect_window_height": 1200, "redirect_window_width": 1200}}

If you need to select several methods – codes are separated by commas. The full list of payment method codes see in IDs of payment methods supported on Payment Page.

Related links