#umaritis_code

1 messages · Page 1 of 1 (latest)

hard mistBOT
#

đź‘‹ Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

đź”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1407366882079670293

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

frail hearth
#

We’re building a game app and originally our subscription flow worked like this:

We collected card details using the Stripe Payment Sheet.

Then we charged the user immediately, which gave us a PaymentIntent + client secret.

We passed that client secret to the Payment Sheet again so the user could confirm the payment in the popup, and everything worked fine.

Now we’ve introduced a free trial:

Since there’s no immediate charge, Stripe doesn’t generate a PaymentIntent.

Instead, we create a subscription with a trial and get a pending_setup_intent with its client secret.

Our backend now returns this setupIntent client secret, along with an ephemeral key, customer ID, and publishable key.

This part is working — the API response looks correct.

Problem:
On the Android client side (using the Stripe Payment Sheet), the popup no longer appears for the user to confirm their card details. It used to appear when we had a PaymentIntent, but with pending_setup_intent it doesn’t show.

Question:

How should our Android developer consume this new API response (with pending_setup_intent client secret) to make the Stripe Payment Sheet display the popup so the user can confirm their payment method during the free trial?

how my android developer consume this api ?

here is the api response :
{
"status": "success",
"message": "Subscription intent created successfully.",
"data": {
"subscriptionId": "sub_1RxqAZ02onFjCrJwjUHFTkBZ",
"paymentIntent": "seti_1RxqAZ02onFjCrJwqNNcWh3Z_secret_StdRsuL2PiX4OKYKr1ZUMv7hkcCEE4f",
"ephemeralKey": "ek_test_YWNjdF8xUDF4RmkwMm9uRmpDckp3LHpBc2hDSVlFWFdmYTBSQjk5UFRweDRvUkVKdEk5OWE_00bm3wE7kU",
"customer": "cus_StZUlJpMrIuuxF",
"publishableKey": "pk_test_51P1xFi02onFjCrJwrieVm9Ez2qLJrOwgKcTOTPkiUVFa01Ed0xHsj3p6GiBy4PC7qoZOfgryy0i8zXYuirceTcoX001p4zjLaS"
},
"error": null,
"version": "M10"
}

what changingshe need to made on his side?

hard mistBOT
split tundra
#

hi there, can you share your code that you're using to pass the pending_setup_intent client secret?

frail hearth
#

yes here is the code i am using :
freeTrialSubscription = await stripe.subscriptions.create({
customer: customerId,
items: [{ price: product.default_price }],
payment_behavior: 'default_incomplete',
payment_settings: { save_default_payment_method: 'on_subscription' },
expand: ['pending_setup_intent'],
// trial_end: Math.floor(Date.now() / 1000) + (60 * 60 * 24 * 7), // 7 days trial
// trial_period_days: 1, // 1 days trial
trial_end: Math.floor(Date.now() / 1000) + (60 * 10),
trial_settings: {
end_behavior: {
missing_payment_method: "cancel"
}
}
});

      clientSecret = freeTrialSubscription.pending_setup_intent.client_secret;

{
subscriptionId: activeSubscription.id,
// paymentIntent: paymentIntent.client_secret,
paymentIntent: clientSecret,
ephemeralKey: ephemeralKey.secret,
customer: customerId,
publishableKey: process.env.STRIPE_PUBLISHABLE_KEY,
},

h

split tundra
#

ok, can you show me how you're passing clientSecret to use the PaymentSheet?

frail hearth