Payments with Pre-authorization

Preauthorization is a two-stage payment: first the amount on the client's card is blocked and then debited separately upon the merchant's confirmation. This approach is used when it is necessary to guarantee the availability of funds, but to debit them later - for example, after confirmation of an order or service.

How it works:

  • Blocking funds - the amount is frozen on the customer's card, but not debited.

  • Confirm or cancel - the merchant can either confirm the debit or cancel the payment.

  • Automatic unlocking - if the payment is not confirmed within a set period of time, the funds are automatically unlocked.


Initialization of payment with preauthorization

To create a payment with preauthorization it is necessary to pass an additional parameter preauth. The full set of parameters is described on the page of payment creation.

GET https://unitpay.ru/api?method=initPayment

Mandatory parameters

Name
Type
Description

preauth

integer

Use this flag to create a payment with preauthorization. By default the flag is disabled and the value is 0, to enable it you must pass 1.

preauthExpireLogic

integer

Field for preauthorization payment blocking logic: 0 - if there is no request for confirmation or cancelation, the payment will be confirmed upon expiration of the blocking period on the side of the acquiring bank (~114 hours after payment creation); 1 - if there is no request for confirmation or cancelation, the payment will be canceled upon expiration of the blocking period on the acquiring bank's side (~114 hours after payment creation). If the option is not used, the payment will be canceled after the deadline.

{
    "result": {
        "type": "redirect",
        "paymentId": 1234567890,
        "message": "The invoice has been successfully issued and payment is pending",
        "receiptUrl": "https://unitpay.ru/pay/receipt/1234567890-454ac183ac",
        "statusUrl": "https://unitpay.ru/pay/receipt/1234567890-454ac183ac",
        "redirectUrl": "https://unitpay.ru/pay/redirect/1234567890-454ac183ac"
    }
}

Payment confirmation with preauthorization

To confirm a payment with preauthorization (debit of funds blocked on the payer's card), execute this request:

GET: https://unitpay.ru/api?method=confirmPayment
     params[paymentId]=2142345678
     params[secretKey]=secretkey

Mandatory parameters

Name
Type
Description

paymentId

integer

Payment ID in the UnitPay system

secretKey

string

Project secret key, available in the project settings

{ "message": "Payment successfully confirmed" }

Cancellation of payment with preauthorization

To cancel a payment with preauthorization (unblocking of funds on the payer's card), perform the following request:

GET: https://unitpay.ru/api?method=cancelPayment
     params[paymentId]=2142345678
     params[secretKey]=secretkey

Mandatory parameters

Name
Type
Description

paymentId

integer

Payment ID in the UnitPay system

secretKey

string

Project secret key, available in the project settings

{ "message": "The blocking has been successfully canceled" }

Last updated

Was this helpful?