#cmchen_65252
1 messages · Page 1 of 1 (latest)
Here you are https://stripe.com/docs/payments/save-during-payment
i want to use Save payment details during payment and my client is dev by vue
do you hava any sample ?
Yeah please see the Doc above
still do not know how to impl by vue
elements.create("card", { style: style }); stripe.confirmCardSetup(setupIntent.client_secret, {
payment_method: {
card: card,
billing_details: { email: email }
}
})
stripeElements("pk_test_51NnAu4H405nfaGplwg8fZNsQZyfQHUzTmvNcO0Vpe2e5wAakl7LxJ9Mz9t9d3NtqsBM1ra9cqyJiLiV63VW2xs1400crvHFmF6",{
client_secret:"pi_3OESi5H405nfaGpl0BtGGm4E_secret_SgxXN6W4PmvoCgqMDn5PNFPCR"
});
Vue is the frontend part and it should follow the same flow. Sorry we don't have a dedicated Doc for Vue but you should be able to reference the Doc and go along
ntegrationError: Invalid value for stripe.confirmCardSetup intent secret: value should be a SetupIntent client secret. You specified: a PaymentIntent client secret.
at E (v3/:1:470260)
Save payment details during payment is still to use PaymentIntent. You are using SetupIntent
Please refer to the Doc above
i am using PaymentIntentCreateParams and .setSetupFutureUsage(PaymentIntentCreateParams.SetupFutureUsage.OFF_SESSION) // set as payment method in future
.setCustomer(stripeId)
.addPaymentMethodType("card")// only use card
.setCaptureMethod(PaymentIntentCreateParams.CaptureMethod.AUTOMATIC)
and return a clientSecret startwith pi_ not seti
Yes so that's a Payment Intent, and you can't use it with confirmCardSetup
You need confirmPayment or confirmCardPayment
parameter_unknown - payment_method_data[card][_isSubmitting]
Received unknown parameters: _isSubmitting, _pendingFonts, _timings, _isLoaderFrameMounted, _elements, _controller, _commonOptions, _id
when i use stripe.confirmCardPayment(
In place of stripe.confirmCardSetup in your client-side/JavaScript code
stripe.confirmCardPayment(setupIntent.client_secret, {
payment_method: {
card: card,
billing_details: { email: email }
}
})
.then(function(result) {
if (result.error) {
changeLoadingState(false);
var displayError = document.getElementById("card-errors");
displayError.textContent = result.error.message;
} else {
// The PaymentMethod was successfully set up
orderComplete(stripe, setupIntent.client_secret);
}
});
Did it work?
no ,this is my server java code
PaymentIntentCreateParams params = PaymentIntentCreateParams.builder()
.setAmount(RandomUtil.randomLong(51,100)) // $1.00
.setCurrency(currency.getValue().toLowerCase()) // USD
.setReceiptEmail(customerModel.getEmail()) //支付成功发送邮箱
.setDescription("add payment method and verify") // 支付描述
.setSetupFutureUsage(PaymentIntentCreateParams.SetupFutureUsage.OFF_SESSION) // set as payment method in future
.setCustomer(stripeId)
.addPaymentMethodType("card")// only use card
.setCaptureMethod(PaymentIntentCreateParams.CaptureMethod.AUTOMATIC)
.putMetadata("setup_intent", "yes")
.build();
pk: "pk_test_51NnAu4H405nfaGplwg8fZNsQZyfQHUzTmvNcO0Vpe2e5wAakl7LxJ9Mz9t9d3NtqsBM1ra9cqyJiLiV63VW2xs1400crvHFmF6",
client_secret:"pi_3OESi5H405nfaGpl0BtGGm4E_secret_SgxXN6W4PmvoCgqMDn5PNFPCR"
var card = elements.create("card", { style: style });
card.mount("#card-element");
stripe.confirmCardPayment(setupIntent.client_secret, {
payment_method: {
card: card,
billing_details: { email: email }
}
})
.then(function(result) {
if (result.error) {
changeLoadingState(false);
var displayError = document.getElementById("card-errors");
displayError.textContent = result.error.message;
} else {
// The PaymentMethod was successfully set up
orderComplete(stripe, setupIntent.client_secret);
}
});
javascipt client code
Did you read the error? Seems unrelated to the code you're sharing with me
You're calling stripe.retrieveSetupIntent somewhere with an invalid client secret
😇 ok let mt check