@vital brook pressed the 🧑💻 Code button in https://discord.com/channels/841573134531821608/842637025524842496 to ask a question:
Code
Creating an intent in backend with conditional intent_params:
if post_params[:is_storing_credit_card_enabled] == true
intent_params[:setup_future_usage] = 'off_session'
end
::Stripe::PaymentIntent.create(
intent_params,
stripe_account: camp.stripe_account_id
)
Frontend on PaymentElement:
const payload = await stripe.confirmPayment({
elements,
clientSecret,
confirmParams: {
return_url: "",
},
redirect: "if_required",
})
Question
OUR THREAD CLOSED, REOPENING
Our integration is fully working, and we've been able to save CC info when using the CardElement, but when trying to save CC info for a Stripe Customer using the PaymentElement, we receive an error:
> The provided setup_future_usage (off_session) does not match the expected setup_future_usage (null). Try confirming with a Payment Intent that is configured to use the same parameters as Stripe Elements.
What have you already attempted?
if we make them match, the request doesn't send from FE, instead erroring with:
stripe.confirmPayment(): do not pass setup_future_usage at confirm time. Instead, pass setup_future_usage when the PaymentIntent is created.
What are you working on?
Campground booking software. In this case, the feature to optionally save CC info for future payments on checkout.