Полоса "статус": "requires_pay_method",Php

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Полоса "статус": "requires_pay_method",

Сообщение Anonymous »

С Jquery интеграция полос работает очень хорошо.
Я пытаюсь интегрировать скрипт без jquery, но у меня возникла проблема: платеж не завершен: "status": "requires_pay_method",
Меня немного заблокировали, потому что я не обнаружил своей ошибки и следую инструкциям по полосам?
Спасибо
[https://stripe.com/docs/payments/accept ... harges#web][1]

Часть самого важного кода:
// have to create intent before loading the javascript because it needs the intent id
$content .= '' .
'';

$content .= '

';
$content .= '

' . $this->app->getDef('text_stripe_credit_card_owner') . '



' . $this->app->getDef('text_stripe_credit_card_type') . '



Card number



Expiry date



CVC







';
$content .= '';
$content .= '';
$content .= '';
$content .= '';
$content .= '';
$content .= '';
$content .= '';
$content .= '';

теперь скрипт



const stripe = Stripe('{$stripe_publishable_key}');
const elements = stripe.elements();

// Custom styling can be passed to options when creating an Element.
const style = {
base: {
// Add your base input styles here. For example:
fontSize: '16px',
color: '#32325d',
},
};

// Create an instance of the card Element.
const card = elements.create('card', {style});

// Add an instance of the card Element into the `card-element` .
card.mount('#card-element');

// Create a token or display an error when the form is submitted.
const form = document.getElementById('payment-form');
form.addEventListener('submit', async (event) => {
event.preventDefault();

const {token, error} = await stripe.createToken(card);

if (error) {
// Inform the customer that there was an error.
const errorElement = document.getElementById('card-errors');
errorElement.textContent = error.message;
} else {
// Send the token to your server.
stripeTokenHandler(token);
}
});

const stripeTokenHandler = (token) => {
// Insert the token ID into the form so it gets submitted to the server
const form = document.getElementById('payment-form');
const hiddenInput = document.createElement('input');
hiddenInput.setAttribute('type', 'hidden');
hiddenInput.setAttribute('name', 'stripeToken');
hiddenInput.setAttribute('value', token.id);
form.appendChild(hiddenInput);

// Submit the form
form.submit();
}



Подробнее здесь: https://stackoverflow.com/questions/662 ... ent-method
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»