Creating a Payment

To interact with the API, use the Unitpay PHP-SDK library.

Required parameters:

Parameters depending on the type of payment:

Additional payment parameters:

****

You can run the query in test mode. Learn more

Request digital signature

For additional security of your payments, we perform mandatory verification of the digital signature when creating a payment. The signature guarantees protection against the substitution of the transmitted values (e.g., changing the payment amount or order number).

Example of creating a digital signature in PHP:

function getFormSignature($account, $currency, $desc, $sum, $secretKey) {
    $hashStr = $account.'{up}'.$currency.'{up}'.$desc.'{up}'.$sum.'{up}'.$secretKey;
    return hash('sha256', $hashStr);
}

Example of creating a digital signature in Perl:

sub getSignature {
    my ($method, $params, $secretKey) = @_;
    delete $params->{sign};
    delete $params->{signature};
    my $s = $method;
    foreach my $key (sort keys %{$params}) {
        $s .= '{up}' . $params->{$key};
    }
    $s .= '{up}' . $secretKey;
    use Digest::SHA qw(sha256_hex);
    return sha256_hex($s);
}

Successful response

{"result": {
    "message": "Payment was created successfully.",
    "paymentId": "1400072",  
    "type": "redirect", 
    "redirectUrl": "http://unitpay.ru/pay/redirect/111-ab34c22" 
}}

Error response

{"error": {
    "message": "Error description"
}}

Last updated