PSP without verifiaction
Online acquiring Visa\MasterCard bank cards (without verification)
Integration consists in embedding the payment button into the partner's website. When clicking on this button, the following is done sending data to the GarryPay system address.
Information
To ensure security, the data sent must be cryptographically signed.
Integration via payment button
The payment button code should looks the same like:
<form action="https://merch-dev.garrypay.com/button" method="post">
<input
type="hidden"
name="data"
value="eyJtZXJjaGFudF9pZCI6IjE1YWU2Yzg4LWJiMGItNGY3Ny1hZjkxLTZhMGNkNWI0NGRlZCIsInB1cmNoYXNlX2lkIjozMTUsImFtb3VudCI6IjMzMTYuMDAiLCJjdXJyZW5jeSI6IlJVQiIsImxhbmciOiJydSIsInBheW1lbnRfbWV0aG9kIjoicDJwIiwiY2FsbGJhY2siOiJodHRwczpcL1wvbWVyY2hhbnQtc2l0ZS5jb21cL2NhbGxiYWNrX3VybCJ9"
>
<input
type="hidden"
name="sign"
value="YjNjOTNhOWE2ZmRlYjIyOTc5ZjMxMTdiMzQ1YmM3YmE2MGI1NjNhOTU0Zjc2NjcyNjc4ZTUzNmVmYjU4MWFjMQ=="
>
</form>
Code example
Info for the data field is preparing by following:
- JS
- PHP
import crypto from "crypto";
const data = new Buffer(JSON.stringify({
merchant_id: "ef73bed1-2591-4a91-a74e-fe68b4e2e4e0"
purchase_id: "234-12",
amount: "300",
currency: "USD",
lang: "ru",
success_url: "https://merchant_site.com/success",
error_url: "https://merchant_site.com/error",
})).toString("base64")
const hmac = crypto.createHmac("sha256", key);
hmac.update(data);
const sign = Buffer.from(hmac.digest("hex")).toString("base64");
$params = [
'merchant_id' => 'ef73bed1-2591-4a91-a74e-fe68b4e2e4e0',
'purchase_id' => '234-12',
'amount' => 300,
'currency' => 'USD',
'lang' => $lang,
'success_url' => 'https://merchant_site.com/success',
'error_url' => 'https://merchant_site.com/error',
];
$data = base64_encode(json_encode($params));
$sign = base64_encode(hash_hmac('sha256', $data), $secret));
Thus the JSON object must translate in string and encode in Base64.
Permissed fields
Name | Type | Default | Description |
---|---|---|---|
merchant_id | string | required | Your merchant's ID |
purchase_id | string | required | Unique Purchase ID |
amount | string | required | Amount in the specified currency |
currency | string | required | The currency in which pay USD |
lang | string | en | Payment interface language, en / ru |
success_url | string | undefined | The URL of the page to which the user is redirected after making the successful payment |
error_url | string | undefined | The URL of the page to which the user is redirected on error |