Payment widget integration with token
To make the Demo PSP payment widget appear to your customers on your website, follow the steps below:
-
Install the widget script.
To make the widget send requests, run the following script on your website:
<script type="text/javascript" src="https://js.begateway.com/widget/be_gateway.js"></script>
-
Create the payment widget.
Register a function to generate the necessary parameters for the
BeGateway
constructor object, and to call out thecreateWidget
method. The payment is considered as successfully completed only after you receive the automatic payment notification.<script type="text/javascript"> this.payment = function() { var params ={ checkout_url: "https://checkout.begateway.com", fromWebview: true, checkout: { iframe: true, test: true, transaction_type: "payment" }, token: "8765a020e1bfe88780943461769f09e0f6ed576431a14a7165ccf6827adf9377", closeWidget: function(status) { // possible values of status variable // successful - transaction is successful // failed - transaction is declined // pending - awaiting transaction confirmation // redirected - customer is redirected to external the payment method system // error - error in input paras/network error/etc // null - payment widget is closed console.debug('close widget callback') } }; new BeGateway(params).createWidget(); }; </script>
-
Call the created function.
Register the call of the above created function to some event, for example, to the “Pay” link click.
<a onclick="payment()" href="#">Pay</a>
Widget parameters
|