С 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
Полоса "статус": "requires_pay_method", ⇐ Php
Кемеровские программисты php общаются здесь
1732280935
Anonymous
С Jquery интеграция полос работает очень хорошо.
Я пытаюсь интегрировать скрипт без jquery, но у меня возникла проблема: [b]платеж не завершен: "status": "requires_pay_method",[/b]
Меня немного заблокировали, потому что я не обнаружил своей ошибки и следую инструкциям по полосам?
Спасибо
[https://stripe.com/docs/payments/accept-a-payment-charges#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();
}
Подробнее здесь: [url]https://stackoverflow.com/questions/66244386/stripe-status-requires-payment-method[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия