Creating a payment (widget)
Last updated
Last updated
A widget is a pop-up window with a payment form. To use the widget, you just need to add its code to the site page, configure the transfer of parameters and create an event for its call (for example, clicking on a button). The example code and description of the used widget parameters are located in the Unitpay personal account in the project settings on the "Payment widget" tab (at the screenshot below).
Additional parameters:
If you've connected an online cash desc in your Unitpay personal account, then in order to generate receipts, you must additionally transfer a number of parameters:
If you'll have any additional questions during the integration, you can ask them to our customer support - in Unit.Help or send your questions to manager@unitpay.money
Value
Description
locale
ru, en
Forcing the language of the widget.
currency
string
The order currency according to ISO 4217 (RUB, UAH, BYN, EUR, USD etc. Currency codes). If the payment system does not support the required currency, the amount will be converted to the payment system currency.
paymentType
string
Code of the payment system, through which the payment will be made.
hideMenu
true, false
Hides the menu with the payment method options.
hideOtherMethods
true, false
Hides the window with the payment method options.
subscription
true
Use this flag, if you want to create a subscription using the payer's card. The subscription ID (subscriptionId) will be passed in the PAY method to your payment handler. The use of subscriptions is possible only after agreement with the Unitpay Security Service.
subscriptionId
number
Subscription ID in the UnitPay system. This parameter must be previously received in the PAY method to your payment handler.
preauth
0,1
Use this flag to create a payment with pre-authorization, by default the flag is switched off and the value is 0
preauthExpireLogic
number
The field for the logic of blocking payments with pre-authorization:
0 - If there is no request for confirmation or cancellation, the payment will be confirmed upon the expiration of the blocking period on the acquiring bank's side (~ 114 hours after the creation of the payment);
1 - If there is no confirmation or cancellation request, the payment will be canceled after the blocking period on the side of the acquiring bank (~ 114 hours after the creation of the payment).
If the parameter is not used, the payment will be canceled after the expiration date.
Value
Description
cashItems
string
Can be formed as in the example or by these ways: btoa(unescape(encodeURIComponent(JSON.stringify([{"name":"Shaverma", "count": 1, "price":10.00, "type":"commodity"}])))) ________________________
const cashItems = [{ name: 'Shaverma', count: 1, price: this.amount, type: 'commodity' }];
btoa(JSON.stringify(cashItems))
Read more here
customerEmail
string
Client's email to which the receipt will be sent
customerPhone
string
Order amount, for example, 10.00. Make sure to check this value with the original order amount.
customerPhone
string
Payer's phone number in international format without "+" (the check won't be sent to it)