Payment widget
The payment widget is a pop-up window that is embedded on the Merchant's website and appears when the Customer clicks the Pay button. It includes secure payment data fields (the data is processed by Payture in compliance with security standards) and an email field for sending an electronic fiscal receipt as required by Federal Law No. 54-FZ (the Russian law on cash registers and fiscal receipts). The payment widget is optimized for mobile devices and for different browsers.
To test the widget, use test cards.
The result for this widget is always a successful payment without 3DS.
For example, card number 4111 1111 1111 1111. The expiration date, CVC2/CVV2, and cardholder can be arbitrary.
The receipt sent is not a fiscal document and serves only to demonstrate how the widget works.
Currently, the widget works only via InPay.
Installation
Example of the head section on a page with the widget:
<head>
<script type="text/javascript" src="path/to/widget/payture-widget.min.js"></script>
<link rel="stylesheet" type="text/css" href="path/to/widget/widgetStyles.css">
</head>Example of opening the widget when Pay is clicked:
<button id="start_widget" onclick="openWidget()">Pay</button>To install the widget on their website, the Merchant needs to complete the following steps:
- Request test access parameters from Payture support.
- By default, the widget uses the standard Payture templates. If the Merchant wants to change the look of the templates, they need to prepare and send to support a payment form template (
Type=Pay) and an operation result template (Type=Return), which opens after the 3DS check. The Merchant can either create their own templates from scratch or modify the standard Payture widget templates. Information, detailed technical guidance on creating templates, and sample widget templates are available on the templates page in the "Widget templates" section. - Include the
payture-widget.min.jslibrary in theheadsection of the page. Download payture-widget.min.js. - Add the styles required by the widget to the
headsection. Download widgetStyles.css. - Define the function that opens the widget. The required parameters are set in the
PaytureWidget()constructor. - Configure the widget to open on some event, for example, when the Pay button is clicked.
- If needed, configure the website's behavior depending on the
successargument of theOnTransactionCompletedfunction. - Test the widget in the test environment using test cards.
- Obtain production access parameters from Payture support and switch to the production environment.
Widget parameters
Example of a function that opens the widget:
function openWidget() {
var widget = new PaytureWidget({
Key : "Merchant_Widget",
Amount : 20,
Product : "Payment for order No. 1",
Domain : 2,
CustomParams :
{
TemplateTag : "Default",
Language : "Default",
Name : "John Smith",
Delivery : "Pickup",
OrderID : "1233abc6688",
Url : "https://site.com/order"
},
ChequeParams :
{
Positions:[
{
Quantity: 1.000,
Price: 10.00,
Tax: 2,
Text: "Tea"
},
{
Quantity : 2.000,
Price : 5.00,
Tax: 2,
Text: "Pie"
}
],
CustomerContact : "",
Message: "Payture receipt"
},
OnTransactionCompleted : function(success) {
alert( success );
}
});
}Parameters passed to the PaytureWidget() constructor:
| Parameter | Description | Format |
|---|---|---|
| Key | Payment terminal name | String (Mandatory) |
| Amount | Payment amount in rubles, with up to 2 digits after the decimal point | Float (Mandatory) |
| Product | Name of the purchase being paid for, shown to the Customer in the payment widget. Substituted into the {Product} placeholder of the widget template | String [1..50] (Optional) |
| Domain | Number that identifies the gateway URL:1 — main address of the Production environment (default)2 — test environment: https://sandbox3.payture.com | Integer (Optional) |
| Session | Operation type:Pay — charge as part of a one-step payment (default)Block — hold of funds as part of a two-step payment. The held funds can then be captured with the Charge command or released with the Unblock command | String (Optional) |
| CustomParams | Contains the name and language of the widget template used, as well as any additional Merchant parameters (for example, payer name, delivery description, order number, page URL). See the subsections below | Object (Optional) |
| ChequeParams | Receipt parameters. Corresponds to the Cheque parameter in the receipt format. See the subsections below | Object (Optional) |
| OnTransactionCompleted | Function called after the transaction completes, before the widget closes. It has one argument, success, which is the operation result: true for a successful payment, false for an unsuccessful payment | Function (Optional) |
CustomParams
Widget template parameters. You can additionally pass any custom Merchant fields; they will be available in the template as placeholders.
| Parameter | Description |
|---|---|
| TemplateTag | Name of the widget template used. Must be passed if the Merchant uses multiple templates. If the parameter is not passed, the template named Default is used. Learn more about payment page templates. |
| Language | Widget template language. Must be passed if the template uses multiple languages. If the parameter is not passed, the Default template language is used. Learn more about payment page templates. |
ChequeParams
Fiscal receipt parameters. The minimum set of fields is listed below:
| Parameter | Description |
|---|---|
| Positions | List of receipt items. Each item includes: • Item name ( Text)• Quantity ( Quantity)• Price ( Price)• Tax ( Tax)Important! The total of the receipt items must equal the operation amount in Amount. For a detailed description of item parameters, see the 54-FZ documentation. |
| CustomerContact | The Customer's phone number in the 79165554444 format or email address for sending the receipt. Used if the Customer does not provide a delivery address in the widget. |
| Message | Email subject or SMS message text. Generally, you can set a default value via Payture support and not pass it. |
Important!
We recommend using the success parameter in OnTransactionCompleted only to determine the subsequent behavior of the Merchant's website. This parameter is vulnerable to manipulation by fraudsters and cannot serve as a guarantee of a successful payment.
To get the actual transaction results, use notifications.
3-D Secure 2.0
Requests are processed differently with 3-D Secure 2.0 authentication than with the first version of the 3-D Secure protocol. The key feature of 3-D Secure 2.0 and its main difference from the first version is…
Ready-made CMS plugins
To make it easier to integrate the payment solution into your online store, you can use ready-made payment plugins.
