Полоса "Статус": "tress_payment_method",Php

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

Сообщение Anonymous »

С 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
Ответить

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

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

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

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

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