Payment Widget

To perform card verification in widget it is required to transfer parameter "requestType":

Widget – is a pop-up payment form for input of requisites of payer without transfer to the site ob payment gate.

The absence of redirection to other sites allows to exclude the risk of losses for the client when transferring from the basket to payment page.

There is no necessity for the site to obtain PCI DSS certification – actually the payment is performed on the side of Wayforpay and visually on the side of site

 

The following script is to be used for initialization of payment widget:

 


 

The following script is to beTo pay an invoice using a widget used for initialization of payment widget:

<script id="widget-wfp-script" language="javascript" type="text/javascript" src="https://secure.wayforpay.com/server/pay-widget.js"></script>

<script type="text/javascript">
var wayforpay = new Wayforpay();
var pay = function () {
wayforpay.run({
merchantAccount : "test_merch_n1",
merchantDomainName : "www.market.ua",
authorizationType : "SimpleSignature",
merchantSignature : "b95932786cbe243a76b014846b63fe92",
orderReference : "DH783023",
orderDate : "1415379863",
amount : "1547.36",
currency : "UAH",
productName : "Процессор Intel Core i5-4670 3.4GHz",
productPrice : "1000",
productCount : "1",
clientFirstName : "Вася",
clientLastName : "Васечкин",
clientEmail : "some@mail.com",
clientPhone: "380631234567",
language: "UA"
},
function (response) {
// on approved
},
function (response) {
// on declined
},
function (response) {
// on pending or in processing
}
);
}
</script>

<button type="button" onclick="pay();">Оплатить</button>


The set of request parameters corresponds the abovementioned request parameters from section Accept payment (Purchase).

*The obligatory fields are also clientFirstName + clientLastName + clientPhone 

In order to display styled widget in parameter array, transfer the parameter theme with code of styled page as the value. Example:

wayforpay.run({ ... requestType: "VERIFY" });

 

To perform card verification in widget it is required to transfer parameter "requestType":

wayforpay.run({ ... straightWidget: true });

 

To close widget in function-event processor it is sufficient to call the wayforpay.closeit(); method

The response parameter in the event processors is the object that contain the signed data with the results of transaction performance.

In addition, at certain event, there are sent to the parent window with the help of postMessage method the following messages:

  • WfpWidgetEventApproved – in case of successful transaction completion
  • WfpWidgetEventDeclined – in case of unsuccessful transaction;
  • WfpWidgetEventPending – transaction is being processed;
  • WfpWidgetEventClose – in case of widget closure by the user.

 

Для оплаты инвойса с помощью виджета

<script id="widget-wfp-script" language="javascript" type="text/javascript" src="https://secure.wayforpay.com/server/pay-widget.js"></script>

<script type="text/javascript">
var wayforpay = new Wayforpay();
var pay = function () {
wayforpay.invoice('<invoiceUrl>');
}
</script>

<button type="button" onclick="pay();">Оплатить</button>

where </invoiceUrl> is the link to the invoice payment page, for example, 'https://secure.wayforpay.com/invoice/ie01a84b32807'

 

If you always need to open the widget (without leaving your page even on mobile devices), you need to pass the second parameter with the value true to the function call wayforpay.invoice: 

...

wayforpay.invoice('https://secure.wayforpay.com/invoice/ie01a84b32807', true);

...