这里有一个奇怪的问题。按照文档,我将 PaymentMethod 附加到现有客户,但它不起作用。粗略地说,我:
编码:
stripe.Customer.create(email=user.email, name=user.full_name)stripe.PaymentIntent.create(amount=amount, currency="aud", customer=user.stripe_customer_id)Stripe('{{ stripe_publishable_key }}').elements().create("card");
stripe.confirmCardPayment('{{ clientSecret }}', {
payment_method: {
card: card,
billing_details: {
// name: 'Jenny Rosen'
},
}
}).then(function (result) {
if (result.error) {
// Show error to your customer (e.g., insufficient funds)
console.log(result.error.message);
var displayError = document.getElementById('card-errors');
displayError.textContent = result.error.message;
} else {
// The payment has been processed!
if (result.paymentIntent.status === 'succeeded') {
// Show a …