Answer the question
In order to leave comments, you need to log in
How to insert data into the database that came from Yandex checkout in Jason format?
{
"id": "111111111111111111111111111111111",
"status": "pending",
"recipient": {
"account_id": "1",
"gateway_id": "0"
},
"amount": {
"value": "100.00",
"currency": "RUB"
},
"description": "Заказ №1",
"created_at": "2020-02-26T18:15:07+00:00",
"confirmation": {
"enforce": false,
"confirmation_url": "[url]https://money.yandex.ru/[/url]",
"type": "redirect"
},
"paid": false,
"refundable": false,
"metadata": {
"order_id": "37"
},
"test": true
}
<?php
namespace App\Http\Controllers\Api\v1;
use Illuminate\Http\Request;
use YandexCheckout\Client;
use YandexCheckout\Model\Payment;
use App\Http\Controllers\Controller;
class PaymentController extends Controller
{
public function index()
{
try {
$client = new Client();
$client->setAuth('__', '__');
$payment = $client->createPayment(
array(
'amount' => array(
'value' => 100.0,
'currency' => 'RUB',
),
'confirmation' => array(
'type' => 'redirect',
'return_url' => '[url]http://p.x:8080/#/[/url]',
),
'capture' => true,
'description' => 'Заказ №1',
'metadata' => array(
'order_id' => '37',
)
),
uniqid('', true)
);
return $payment;
// var_dump($payment);
// dd($payment);
} catch (\Exception $exception) {
return [
'status' => 'error',
'message' => $exception->getMessage(),
];
}
}
uniqid('', true)
);
$payment = new PaymentController($payment);
$payment1->status = 'status';
$this->paid = 'paid';
$this->value = 'value';
$this->currency = 'currency';
$this->type = 'type';
$this->confirmation_url = 'confirmation_url';
$this->description = 'description';
$this->metadata = 'metadata';
$this->account_id = 'account_id';
$this->gateway_id = 'gateway_id';
$this->refundable = 'refundable';
$this->order_id = 'order_id';
$this->save();
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