Я пытаюсь интегрировать API платежей Selly.gg с моей системой.
Документация для создания платежа находится здесь: https://developer.selly.gg/#create-a-payment
А вот мой код:
$ch = curl_init();
$data = array(
"title" => "My Payment",
"gateway" => "PayPal",
"email" => $_GET["email"],
"value" => $price * $_GET["stock"],
"currency" => "USD",
"return_url" => "http://example.com",
"webhook_url" => "http://example.com/callback.php?paid=true"
);
$data_curl = json_encode($data);
curl_setopt($ch, CURLOPT_URL, "https://selly.gg/api/v2/pay");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_curl);
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Authorization: Basic ".base64_encode('EMAIL:APIKEY');
$headers[] = "Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
//echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
echo $result;
Однако я получаю {"message":["Currency is not one we support","Currency can't be blank","Value is not a number","Value can't be blank","Email can't be blank","Gateway is not included in the list","Gateway can't be blank","Return url can't be blank","Webhook url can't be blank","Title is too short (minimum is 2 characters)"]}
УВЕДОМЛЕНИЕ : я даже пытался установить массив непосредственно в POSTFIELDS, но у него тот же результатмассива в кодировке JSON.
Любая помощь приветствуется.