Код: Выделить всё
const getToken = async () => {
try {
await axios.get('/sanctum/csrf-cookie');
} catch (error) {
console.error("Failed in getting CSRF:", error);
}
};
const savePaymentMethod = async () => {
localStorage.setItem('paymentMethod', paymentForm.value.payment_method);
try {
await getToken();
await axios.post('/checkout');
} catch (error) {
console.error("Error with sending payment:", error);
}
};
Код: Выделить всё
Payment Method:
Select payment method
Stripe
Pay
Я пробовал поместить токен в метатег заголовка (просмотр)
Как в этом примере: Как ссылаться на поле csrf laravel внутри шаблона vue
Подробнее здесь: https://stackoverflow.com/questions/790 ... ing-stripe
Мобильная версия