С jQuery интеграция полосы работает очень хорошо.
Я пытаюсь интегрировать скрипт без jQuery, но у меня есть проблема, потому что платеж неполный: «Статус»: «Tress_payment_method»,
Я мало заблокирован, потому что я не нахожу свою ошибку, и я следую за Стронией? /> Спасибо < /p>
[https://stripe.com/docs/payments/accept ... harges#web][1]
< /code>
часть наиболее важного кода: < /p>
// 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 .= '';
< /code>
Теперь скрипт < /p>
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
Полоса "Статус": "tress_payment_method", ⇐ Php
Кемеровские программисты php общаются здесь
1753099695
Anonymous
С jQuery интеграция полосы работает очень хорошо.
Я пытаюсь интегрировать скрипт без jQuery, но у меня есть проблема, потому что платеж [b] неполный: «Статус»: «Tress_payment_method», [/b]
Я мало заблокирован, потому что я не нахожу свою ошибку, и я следую за Стронией? /> Спасибо < /p>
[https://stripe.com/docs/payments/accept-a-payment-charges#web][1]
< /code>
часть наиболее важного кода: < /p>
// 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 .= '';
< /code>
Теперь скрипт < /p>
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антехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия