A
A
Alexey2022-01-22 11:19:21
PHP
Alexey, 2022-01-22 11:19:21

Why is there an error in the qiwi API when transferring to a bank card?

Trying to send money to Russian VISA:

$option = [
  'id' => 1000*strtotime('now'),
  'fields' => ['account' => '42767************'],
  'sum' => ['amount' => 100, 'currency' => '643'],
  'paymentMethod' => ['type' => 'Account', 'accountId' => '643'],
];  
$token_qiwi = "**************";             
$zapros = curl_init();
$arr[CURLOPT_URL] = 'https://edge.qiwi.com/sinap/api/v2/terms/1963/payments';
$arr[CURLOPT_RETURNTRANSFER] = TRUE;
$arr[CURLOPT_TIMEOUT] = 10;
$arr[CURLOPT_HTTPHEADER] = array("Accept: application/json", "Content-type: application/json", "Authorization: Bearer ".$token_qiwi);
$arr[CURLOPT_POST] = TRUE;
$arr[CURLOPT_POSTFIELDS] = json_encode($option);
curl_setopt_array($zapros, $arr);
echo curl_exec($zapros);    
curl_close($zapros);

Writes:

{"message":"Json validation error List((obj.id,List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))))"}

What am I doing wrong?

The token has all permissions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2022-01-22
@olololollloo

Tell me what am I doing wrong?
you don't read the error, there is error.expected.jsstring Slightly strain your brain, they want a string from you, let's figure out where?
Threat, even a search for jsstring on the site will already give an answer.
ZZYY
already read all the documentation along and reproached
I don’t know what you read there, but when they write to you about a validation error, you need to run to the descriptions of the request structure and check each type

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question