Public
Payment widget
Widget for payment acceptance on web page of website

Scheme of payment widget work:
Connection
  1. Create sompany in LiqPay by the link:
    After registration for your company there will be automatically created unique access keys for API:
    public_key - unique ID for your company in LiqPay system
    private_key - secret access key for API
  2. According to the technical documentation, integrate widget.
Forming a request to API for self-integration:
Example JS widget:

<div id="liqpay_checkout"></div>
<script>
    window.LiqPayCheckoutCallback = function() {
	    LiqPayCheckout.init({
			data: "eyAidmVyc2lvbiIgOiAzLCAicHVibGljX2tleSIgOiAieW91cl9wdWJsaWNfa2V5IiwgImFjdGlv" +
			"biIgOiAicGF5IiwgImFtb3VudCIgOiAxLCAiY3VycmVuY3kiIDogIlVTRCIsICJkZXNjcmlwdGlv" +
			"biIgOiAiZGVzY3JpcHRpb24gdGV4dCIsICJvcmRlcl9pZCIgOiAib3JkZXJfaWRfMSIgfQ==",
			signature: "QvJD5u9Fg55PCx/Hdz6lzWtYwcI=",
			embedTo: "#liqpay_checkout",
			language: "ru",
			mode: "embed" // embed || popup
	    }).on("liqpay.callback", function(data){
	    	console.log(data.status);
	    	console.log(data);
	    }).on("liqpay.ready", function(data){
	    	// ready
	    }).on("liqpay.close", function(data){
	    	// close
	    });
	};
</script>
<script src="//static.liqpay.ua/libjs/checkout.js" async></script>
Payment widget parameters
data Required String json string with APIs parameters encoded by the function base64_encode( json_string ), where base64_encode - returns a string encoded by base64
signature Required String Is the unique signature of each request base64_encode( sha1( private_key + data + private_key) ), where sha1 - returns the hash as a 20-character binary string.
embedTo Optional String The element on the HTML page in which the widget will be displayed
mode Optional String The mode of displaying the widget on the site. Possible values: embed - the built-in window, popup - a pop-up window on your site.
language Optional String The language of the payment widget ru, uk, en.
Example of using SDK:
#!/bin/bash
PUBLIC_KEY='your_public_key'
PRIVATE_KEY='your_private_key'
JSON="{ 
\"version\" : 3,
\"public_key\" : \"${PUBLIC_KEY}\", 
\"action\" : \"pay\", 
\"amount\" : 1, 
\"currency\" : \"USD\",
\"description\" : \"description text\",
\"order_id\" : \"order_id_1\"
}"
# DATA is base64_encode result from JSON string
DATA=$(echo -n ${JSON} | base64)
# SIGNATURE is base64 encode result from sha1 binary hash from concatenate string ${PRIVATE_KEY}${DATA}${PRIVATE_KEY}
SIGNATURE=$(echo -n "${PRIVATE_KEY}${DATA}${PRIVATE_KEY}" | openssl dgst -binary -sha1 | base64)
echo "data: ${DATA}"
echo "signature: ${SIGNATURE}"

# DATA in this example
# eyAidmVyc2lvbiIgOiAzLCAicHVibGljX2tleSIgOiAieW91cl9wdWJsaWNfa2V5IiwgImFjdGlv
# biIgOiAicGF5IiwgImFtb3VudCIgOiAxLCAiY3VycmVuY3kiIDogIlVTRCIsICJkZXNjcmlwdGlv
# biIgOiAiZGVzY3JpcHRpb24gdGV4dCIsICJvcmRlcl9pZCIgOiAib3JkZXJfaWRfMSIgfQ==

# SIGNATURE in this example
# QvJD5u9Fg55PCx/Hdz6lzWtYwcI=
$liqpay = new LiqPay($public_key, $private_key);
$html = $liqpay->cnb_form(array(
'action'         => 'pay',
'amount'         => '1',
'currency'       => 'USD',
'description'    => 'description text',
'order_id'       => 'order_id_1',
'version'        => '3'
));
HashMap<String, String> params = new HashMap<String, String>();
params.put("action", "pay");
params.put("amount", "1");
params.put("currency", "USD");
params.put("description", "description text");
params.put("order_id", "order_id_1"); 
params.put("version", "3"); 
LiqPay liqpay = new LiqPay(PUBLIC_KEY, PRIVATE_KEY);
String html = liqpay.cnb_form(params);    
System.out.println(html);
 
liqpay = LiqPay(public_key, private_key)
html = liqpay.cnb_form({
"action"         : "pay",
"amount"         : "1",
"currency"       : "USD",
"description"    : "description text",
"order_id"       : "order_id_1",
"version"        : "3"
})
liqpay = Liqpay::Liqpay.new(
:public_key  => 'public_key',
:private_key => 'private_key'
)
html = liqpay.cnb_form({
:action         => "pay",
:amount         => "1",
:currency       => "USD",
:description    => "description text",
:order_id       => "order_id_1",
:version        => "3"
})
LiqPay = liqpay:init(PublicKey, PrivateKey),
Html = liqpay:cnb_form([ 
{<<"action">>,      <<"pay">>}, 
{<<"amount">>,      <<"1">>}, 
{<<"currency">>,    <<"USD">>}, 
{<<"description">>, <<"description text">>}, 
{<<"order_id">>,    <<"order_id_1">>},
{<<"version">>,     <<"3">>}
], LiqPay)
var LiqPay = require('liqpay');
var liqpay = new LiqPay(public_key, private_key);
var html = liqpay.cnb_form({
'action'         : 'pay',
'amount'         : '1',
'currency'       : 'USD',
'description'    : 'description text',
'order_id'       : 'order_id_1',
'version'        : '3'
});
my $liqpay = Liqpay->new($public_key,$private_key);
my $html = $liqpay->cnb_form({
'action'         => 'pay',
'amount'         => '1',
'currency'       => 'USD',
'description'    => 'description text',
'order_id'       => 'order_id_1',
'version'        => '3'
}
);
Init("my_public_key", "my_private_key")
Form(map[string]interface{}{
"action": "pay",
"version": 3,
"public_key": PublicKey,
"amount": 1,
"currency": "UAH",
"description": "Test payment",
"order_id": "order_id_1",
}
);
Options for generating data:
Main
Parameter Required Type Description
version Required Number Version API. Current value - 3
public_key Required String Public key - the store identifier. You can get the key in the store settings
action Required String Transaction type. Possible values: pay - payment, hold - amount of hold on sender's account, subscribe - regular payment, paydonate - donation, auth - card preauth
amount Required Number Payment amount. For example: 5, 7.34
currency Required String Payment currency. Possible values: USD, EUR, RUB, UAH
description Required String Payment description.
order_id Required String Unique purchase ID in your shop. Maximum length is 255 symbols.
expired_date Optional String Date and time untill which customer is able to pay invoice by UTC. Should be sent in the following format 2016-04-24 00:00:00
language Optional String Customer's language ru, uk, en
paytypes Optional String Parameter that gets the methods of payments that displayed on checkout. Possible values card - card payment, liqpay - with liqpay account, privat24 - with privat24 account, masterpass - with masterpass account, moment_part - installments, cash - cash, invoice - to email, qr - qr code scanning. If the parameter is not passed, shop settings will be applied, Checkout tab.
result_url Optional String URL of your shop where the buyer would be redirected after completion of the purchase. Maximum length 510 symbols.
sandbox Optional String Enables the testing environment for developers. Payer card will not be charged. To enable testing environment you will need to transmit value 1. All test payments will have the status sandbox - successful test payment.
server_url Optional String URL API in your store for notifications of payment status change (server->server). Maximum length is 510 symbols. Learn more
verifycode Optional String Possible value Y. Dynamic verification code is generated and going back to Callback. Also generated code will be transferred to verification transactions for displaying in statement by client's card. Works for action= auth.
Parameters of splitting the payments
split_rules Optional String Payment with split amount for a few receivers. This parameter is a JSON array containing split rules. While using split_rules parameter, card is being charged and amount is split and credited to a few receivers. Acquiring fee is being charged from each shop in the split_rules. Example JSON string:
[
  {
    "public_key": "i000000001",
    "amount": 1,
    "commission_payer": "sender",
    "server_url": "https://server1/callback"
  },
  {
    "public_key": "i000000002",
    "amount": 2,
    "commission_payer": "receiver",
    "server_url": "https://server2/callback"
  }
]
Sender parameters
sender_address NEW Optional String Sender's address
sender_city Optional String Sender's city
sender_country_code Optional String Country code of the sender. Digital ISO 3166-1 code
sender_first_name Optional String Sender's first name
sender_last_name Optional String Sender's last name
sender_postal_code Optional String Sender's zip code
Letter of credit parameters
letter_of_credit Optional String To enable receipt of payments within letter of credit send request with the value1
letter_of_credit_date Optional String The expiry date of the letter of credit in the following format 2015-03-31 00:00:00 by UTC.
Regular payment parameters
subscribe Optional String Regular payment. Possible values: 1
subscribe_date_start Optional String Date of the first payment. Time must be specified in the following format 2015-03-31 00:00:00 по UTC. If past date is indicated - subscription will be activated with the date and time of request
subscribe_periodicity Optional String Period of payments. Possible values:
month - once in a month
year - once in a year
Parameters for 1-click payment
customer Optional String Unique customer ID in your shop. When you transfer the parameter LiqPay storesthe payment details of the customer and his ID - the next payment can be made in 1-click. Max length 100 symbols.
(When using the parameter for Masterpass 1-click, the valid payer's phone number is transmitted in this field)
recurringbytoken Optional String Allows to generate payer card_token which you receive in callback request to server_url. card_token allows to make recurring payments without payer card details via API payment by token - it means 1-click. For getting card_token please send in request value: 1
customer_user_id Optional String The user ID in the system of the merchant, is transferred with each user’s payment (doesn’t have to match customer, it is used for payment with the help of Masterpass 1-click wallet)
Other parameters
dae Optional String Detail Addenda.
Parameter dae is JSON string, to which function base64. JSON can contain the following parameters:
{
  "airLine": "Avia", // airline abbreviation, max 4 symbols.
  "ticketNumber": "ACSFD12354SA", // ticket number, max 15 symbols. 
  "passengerName": "John Doe", // passenger name, max 29 symbols.
  "flightNumber": "742", // flight number, max 5 number.
  "originCity": "DP", // departure city/airport code, max 5 symbols.
  "destinationCity": "NY", // arrival city/airport code, max 5 symbols.
  "departureDate": "100514" // departure date in format YYMMDD, max 6 number.
}
Example of parameter dae: ewogICJhaXJMaW5lIjogIkROSVBST0FWSUEiLAogICJ0aWNrZXROdW1iZXIiOiAiQUNTRkQxMjM1NFNBIiwKICAicGFzc2VuZ2VyTmFtZSI6ICJKb2huIERvZSIsCiAgImZsaWdodE51bWJlciI6ICI3NDIiLAogICJvcmlnaW5DaXR5IjogIkRQIiwKICAiZGVzdGluYXRpb25DaXR5IjogIk5ZIiwKICAiZGVwYXJ0dXJlRGF0ZSI6ICIxMDA1MTQiCn0=
info Optional String Information to add details to payment. For example: "External information for payments"
product_category Optional String Product category in your shop. The maximum length is 25 symbols.
product_description Optional String Product description in your shop. The maximum length is 500 symbols.
product_name Optional String Product name in your shop. The maximum length is 100 symbols.
product_url Optional String Product page address. The maximum length is 2000 symbols.