Private
Subscription
Regular billing of your clients by server-server method

Unsubscribe

Required URLs for work depending on the model chosen:
  • https://www.liqpay.ua/api/request — Server-Server;
  • https://www.liqpay.ua/api/3/checkout — Client-Server;
To call the LiqPay API you need to pass the data and signature (Server - Server) parameters via the POST method or redirect the client (Client-Server) using the POST method, where:
data
- json string with APIs parameters encoded by the function base64, base64_encode( json_string ),
signature
- is the unique signature of each request base64_encode( sha1( private_key + data + private_key) ),
base64_encode
- returns a string encoded by the base64,
sha1
- the hash is returned as a binary string of 20 characters.
Forming data and signature, example:
To connect the receiving of payment via LiqPay, forming json string with parameters api call, wherein:
ParameterRequiredTypeDescription
versionRequiredNumberВерсія API. Наприклад: 3
public_keyRequiredStringPublic_key - the identifier of the created company. For example: i00000000
private_keyRequiredStringPrivate key of the created company (not available to anyone except your developer). For example: a4825234f4bae72a0be04eafe9e8e2bada209255
actionRequiredStringTransaction type. Possible values: pay - payment, hold - amount of hold on sender's account, subscribe - payment payment, paydonate - donation
amountRequiredNumberPayment amount. For example: 5, 7.34
currencyRequiredStringPayment currency. Possible values: USD, EUR, UAH. Additional currencies can be added by company's request
descriptionRequiredStringPayment description
order_idRequiredStringUnique purchase ID in your shop. Maximum length is 255 symbols
Example of creating json_string:
json_string = {"public_key":"i00000000","version":"3","action":"pay","amount":"3","currency":"UAH","description":"test","order_id":"000001"}
Example of coding json_string function base64_encode, the company receives data:
data = eyJwdWJsaWNfa2V5IjoiaTAwMDAwMDAwIiwidmVyc2lvbiI6IjMiLCJhY3Rpb24iOiJwYXkiLCJhbW91bnQiOiIzIiwiY3VycmVuY3kiOiJVQUgiLCJkZXNjcmlwdGlvbiI6InRlc3QiLCJvcmRlcl9pZCI6IjAwMDAwMSJ9
An example formation of signature, the company forms the string sign_string by concatenating private_key + data + private_key:
sign_string = a4825234f4bae72a0be04eafe9e8e2bada209255eyJwdWJsaWNfa2V5IjoiaTAwMDAwMDAwIiwidmVyc2lvbiI6IjMiLCJhY3Rpb24iOiJwYXkiLCJhbW91bnQiOiIzIiwiY3VycmVuY3kiOiJVQUgiLCJkZXNjcmlwdGlvbiI6InRlc3QiLCJvcmRlcl9pZCI6IjAwMDAwMSJ9a4825234f4bae72a0be04eafe9e8e2bada209255
After applying the functions base64_encode( sha1( sign_string) ) we get the string:
signature = wR+UZDC4jjeL/qUOvIsofIWpZh8=
Example of sending a request to LiqPay:
1.To redirect the client to the LiqPay payment page (Client - Server), you need to generate an HTML form
<form method="POST" action="https://www.liqpay.ua/api/3/checkout" accept-charset="utf-8">
<input type="hidden" name="data"
value="eyJwdWJsaWNfa2V5IjoiaTAwMDAwMDAwIiwidmVyc2lvbiI6IjMiLCJhY3Rpb24iOiJwYXkiLCJhbW91bnQiOiIzIiwiY3VycmVuY3kiOiJVQUgiLCJkZXNjcmlwdGlvbiI6InRlc3QiLCJvcmRlcl9pZCI6IjAwMDAwMSJ9"/>
<input type="hidden" name="signature" value="wR+UZDC4jjeL/qUOvIsofIWpZh8="/><input
type="image" src="//static.liqpay.ua/buttons/payUk.png"/></form>
2.For interaction (Server - Server), the received data and signature must be sent to the url https://www.liqpay.ua/api/request
curl --silent -XPOST https://www.liqpay.ua/api/request --data-
urlencodedata="eyJwdWJsaWNfa2V5IjoiaTAwMDAwMDAwIiwidmVyc2lvbiI6IjMiLCJhY3Rpb24iOiJwYXkiLCJhbW91bnQiOiIzIiwiY3VycmVuY3kiOiJVQUgiLCJkZXNjcmlwdGlvbiI6InRlc3QiLCJvcmRlcl9pZCI6IjAwMDAwMSJ9"/>
--data-urlencode
signature="wR+UZDC4jjeL/qUOvIsofIWpZh8="
3.The status of the operation will be sent to server_url
4.Successful completion of payment

Example of using SDK:
#!/bin/bash
PUBLIC_KEY='your_public_key'
PRIVATE_KEY='your_private_key'
API_URL='https://www.liqpay.ua/api/request'
JSON="{ 
\"action\" : \"unsubscribe\",
\"version\" : 3,
\"public_key\" : \"${PUBLIC_KEY}\", 
\"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)
# REQ is json response from liqpay
REQ=$(curl --silent -XPOST ${API_URL} --data-urlencode data="${DATA}" --data-urlencode signature="${SIGNATURE}")
echo "Result: ${REQ}"
Options for generating data:
Main
ParameterRequiredTypeDescription
versionRequiredNumberVersion API. Current value - 3
public_keyRequiredStringPublic key - the store identifier. You can get the key in the store settings
actionRequiredStringunsubscribe
order_idRequiredStringUnique purchase ID in your shop. Maximum length is 255 symbols
Response parameters:
ParameterTypeDescription
acq_idNumberAcquirer ID
actionStringTransaction type. Possible values: pay - payment, hold - amount of hold on sender's account, paysplit - splitting payments, subscribe - creation of a regular payment, paydonate - donation, auth - card preauth, regular - regular payment
agent_commissionNumberAgent comission in payment currency
amountNumberPayment amount
amount_bonusNumberPayer bonus amount in payment currency debit
amount_creditNumberPayment amount for credit in currency of currency_credit
amount_debitNumberPayment amount for debit in currency of currency_debit
card_tokenStringSender's card token
commission_creditNumberCommission from the receiver in currency_credit
commission_debitNumberCommission from the sender in currency_debit
create_dateStringDate of payment creation
currencyStringPayment currency
currency_creditStringTransaction currency of credit
currency_debitStringTransaction currency of debit
descriptionStringPayment description
end_dateStringDate of payment edition/end
is_3dsBooleanPossible values:
true - transaction passed with 3DS, false - transaction passed without 3DS
liqpay_order_idStringPayment order_id in LiqPay system
mpi_eciNumberPossible values: 5 - the transaction passed with 3DS (issuer and acquirer support 3d Secure technology), 6 - the issuer of the payer card does not support 3d Secure technology, 7 - the operation passed without 3d Secure
order_idStringOrder_id payment
payment_idNumberPayment id in LiqPay system
paytypeStringMethods of payment. Possible values card - card payment, privat24 - with privat24 account, moment_part - installments, cash - cash, invoice - to email, qr - qr code scanning
public_keyStringShop public key
receiver_commissionNumberReceiver comission in payment currency
resultStringThe result of the request ok, error
sender_bonusNumberSender's bonus in the payment currency
sender_card_bankStringSender's card bank
sender_card_countryStringSender's card country. Digital ISO 3166-1 code
sender_card_mask2StringSender's card
sender_card_typeStringSender's card type MC/Visa
sender_commissionNumberCommission from the sender in the payment currency
sender_phoneStringSender's phone number
statusStringPayment status.
Available values:
Final payment statuses
error - Failed payment. Data is incorrect
failure - Failed payment
success - Successful payment
unsubscribed - Subscribed successfully deactivated
transaction_idNumberId transactions in the LiqPay system
typeStringPayment type
versionNumberVersion API. Present value - 3
Example response:
{
  "acq_id": "414963",
  "action": "subscribe",
  "agent_commission": "0.0",
  "amount_bonus": "0.0",
  "amount_credit": "38.31",
  "amount_debit": "38.31",
  "amount": "1.0",
  "commission_credit": "0.57",
  "commission_debit": "0.0",
  "create_date": "1705651874776",
  "currency_credit": "UAH",
  "currency_debit": "UAH",
  "currency": "USD",
  "description": "{{info.edittext_6686}}",
  "end_date": "1705651920384",
  "is_3ds": "false",
  "liqpay_order_id": "HGJI2AU61705651874774315",
  "mpi_eci": "7",
  "order_id": "order_id_76587576",
  "payment_id": "2416590001",
  "paytype": "card",
  "public_key": "sandbox_i63492854596",
  "receiver_commission": "0.02",
  "result": "ok",
  "sender_bonus": "0.0",
  "sender_card_bank": "Test",
  "sender_card_country": "804",
  "sender_card_mask2": "424242*42",
  "sender_card_type": "visa",
  "sender_commission": "0.0",
  "sender_phone": "380950000001",
  "status": "unsubscribed",
  "transaction_id": "2416590001",
  "type": "buy",
  "version": "3",
  "card_token": "6E28D6039FD09FA3CE1DF27BCC2DE0E3254A3B27"
}