@hikkan_no_1

Пробую настроить WeChat payments Stripe, но выскакивает ошибка?

Пробую настроить WeChat payments Stripe. Но выскакивает следующая ошибка "Fatal error: The source you provided is not in a chargeable state thrown". Подскажите, пожалуйста, из-за чего может выкидывать данную ошибку?
stripe.createSource({
  type: 'wechat',
  amount: sum*100,
  currency: 'eur',
}).then(function(result) {
  console.log(result)
  
  $('#wee-wee-chat').prop('href', result.source.wechat.qr_code_url)
  $.ajax({
    url: 'index.php?route=module/StripePayment/create',
    type: 'post',
    dataType: 'json',
    data: JSON.stringify({...purchase, ...result.source, ...price}),
    success: function (json) {
      console.log(purchase)
         clientSecret = String(result.source.client_secret);
         some = json.some;
         
    }, error: function(e){
      console.log(e)
    }
  }); 
}).then(function(result){
  console.log(result)
}).catch(function(err){
  console.log(err)
})

try {
// retrieve JSON from POST body
$json_str = file_get_contents('php://input');
$json_obj = json_decode($json_str);

$charge = \Stripe\Charge::create([
'amount' =>   $json_obj->price,
'currency' => 'eur',
'source' => $json_obj->id,
]);
echo json_encode($output);
} catch (Error $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}
  • Вопрос задан
  • 34 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
YCLIENTS Москва
от 200 000 до 350 000 ₽
Ведисофт Екатеринбург
от 25 000 ₽
ИТЦ Аусферр Магнитогорск
от 100 000 до 160 000 ₽
25 апр. 2024, в 12:23
2500 руб./за проект
25 апр. 2024, в 12:21
10000 руб./за проект