Сбербанк REST API для Yii2 ¶
- Настройка
- Использование
Настройка ¶
'modules' => [
'sberbank' => [
'class' => dicr\sberbank\SberbankModule::class,
'userName' => 'user-api',
'password' => 'my-password'
]
];
Использование ¶
Создание платежа ¶
$module = Yii::$app->getModule('sberbank');
$request = $module->registerPaymentRequest([
'orderNumber' => $orderNumber,
'returnUrl' => 'https://test.ru',
'orderBundle' => [
'cartItems' => [
'items' => [
[
'positionId' => 1,
'name' => 'Русская водка',
'code' => 'VODKA-777',
'price' => 1203,
'quantity' => ['value' => 1.255, 'measure' => 'л']
],
[
'positionId' => 2,
'name' => 'Пряная селедка',
'code' => 'СЕЛ-Д',
'price' => 1236,
'quantity' => ['value' => 2, 'measure' => 'шт'],
'amount' => 2472
],
]
]
]
]);
$response = $request->send();
$orderId = $response->orderId;
$response->redirect();
Получение статуса платежа ¶
$module = Yii::$app->getModule('sberbank');
$req = $module->orderStatusRequest([
'orderId' => $orderId
]);
$res = $req->send();
$orderStatus = $res->orderStatus;
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.