Answer the question
In order to leave comments, you need to log in
How to make a subscription on the site through liqpay?
Hello. It is necessary to implement a paid subscription on the site for a month or two, or for the user to indicate the period himself. Liqpay was chosen to implement this case. But I ran into the problem that I can not get a callback from liqpay about a payment that was just made.
So far, I have written such a code for sending data to liqpay.
$private_key = "многоразныхбукв";
$public_key = "многоцыфрибуква";
$json_string = json_encode(
array(
"version" => "3",
"public_key" => $public_key,
"amount" => "1",
"currency" => "UAH",
"description" => "Назначение платежа",
"type" => "subscribe",
"resp_format" => "json",
"order_id" => date("d/m/Y-H:i:s"),
"server_url" => route("projects"),
"result_url" => route("projects"),
"sandbox" => "1"
)
);
$data = base64_encode( $json_string );
$signature = base64_encode( sha1($private_key . $data . $private_key, 1 ));
<form id="liqpay" method="POST" action="https://www.liqpay.com/api/checkout" accept-charset="utf-8">
<input type="hidden" name="data" value="{{ $data }}" />
<input type="hidden" name="signature" value="{{ $signature }}" />
<input type="submit">
</form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question