Answer the question
In order to leave comments, you need to log in
How to catch php request logs?
I send a request to Sberbank
function register_order($order_number, $amount, $return_url, $order_description, $order_bundle, $params = [])
{
$data = [
'orderNumber' => $order_number,
'amount' => $amount,
'language' => 'ru',
'currency' => '643',
'jsonParams' => '{"phone":"+79277777777"}',
'returnUrl' => $return_url,
'description' => $order_description,
'orderBundle' => $order_bundle
];
// Запишем доп. параметры
if (!empty($params)) {
foreach ($params as $param_name => $val) {
if($val !== false) {
$data[$param_name] = $val;
}
}
}
$method = 'sbercredit/register.do';
$response = $this->gateway($method, $data);
return $response;
}
const TEST_URL = 'https://3dsec.sberbank.ru/';
private function gateway($method, $data)
{
$data['userName'] = $this->user_name;
$data['password'] = $this->password;
if ($this->test_mode) {
$url = self::TEST_URL;
} else {
$url = self::PROD_URL;
}
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url . $method,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($data)
]);
$response = curl_exec($curl);
$response = json_decode($response, true);
curl_close($curl);
return $response;
}
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