#pl_api

1 messages · Page 1 of 1 (latest)

edgy dewBOT
#

đź‘‹ 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/1272764131384098906

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

violet glen
#

customer_id: cus_QZ1ahW7JKznSLd
default payment_method id: pm_1PhtZfP7LyQtEQaSfXCmhSSD

mental dagger
#

Checkout Session doesn't support listing all the saved payment methods.

From https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-customer:

In subscription mode, the customer’s default payment method will be used if it’s a card, otherwise the most recently saved card will be used.

violet glen
#

I understand regarding the list. Thank you.
The default payment method is set, but why is this not embedded?

mental dagger
#

Could you share the example Checkout Session ID (cs_xxx), so that I can take a look?

edgy dewBOT
violet glen
twin bough
violet glen
#

I thought from the API description that all I had to do was specify the id of the Customer for whom the default payment method was set, but does that mean I also need to deal with the link?
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-customer

customer string
ID of an existing Customer, if one exists. In payment mode, the customer’s most recently saved card payment method will be used to prefill the email, name, card details, and billing address on the Checkout page. In subscription mode, the customer’s default payment method will be used if it’s a card, otherwise the most recently saved card will be used. A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer’s card details.

twin bough
violet glen
#

Isn't this an option for "storing" the card information entered in the session?

#

I'll try.

#
  1. Update to and create session with payment_method_save = enabled
  2. In the session, turn on the card details and "Save my payment information for future purchases" and subscribe.
    The card information has been registered. (Visa ...4242 Jan 2025)
  • Logs
    POST /v1/checkout/sessions: req_k9s459VVeCRTFk
    POST /v1/payment_pages/cs_test_a15ypHakxmlKMViX0tBDcstPee6ZMP3BaHOYMmKqZu7EljJVrOrebBKttb: req_BQYjXezUojxs6w
  1. Create session again (same parameters as 1).
    -> The card information set in 2 is not embedded.
  • Logs
    POST /v1/checkout/sessions: req_cz5zPYTDtiTQ55
await stripe.checkout.sessions.create({
  customer: customerId,
  line_items: items,
  mode: "subscription",
  success_url: returnUrl,
  cancel_url: returnUrl,
  payment_method_types: ["card"],
  saved_payment_method_options: {
    payment_method_save: "enabled",
  },
  locale: "en",
});
twin bough
#

Thanks for waiting.

#

So you don't see any saved payment mehtods in the 2nd checkout page?

violet glen
#

That's right.
As a supplementary note, in the first Checkout, I just set the check box to on; I did not enter a phone number for Link.

twin bough
#

Ok, you need to remove saved_payment_method_options in the 2nd checkout session creation request

violet glen
#

I tried deleting and creating a session (for 3rd time), but the payment method I registered for 1st time is not embedded.
req_QEfqjStkMVKHF7

violet glen
#

I would like to ask one more question.
When creating a Subscription using Session, I would like to include two types of interval, monthly and yearly, as candidates for the item, but when I specify them, I receive the following error message.
Checkout does not support multiple prices with different billing intervals.

Is there a way to create a registration screen using Stripe hosted ui that selects from Subscription Items of multiple time periods? If not, what is the recommended flow?

twin bough
#

No, you can't create a subscription with prices of different billing intervals.

#

The workaround is to create to subscriptions separately

violet glen
#

Can you tell us the difference between the following two?
subscription Assuming an update, how would you use it differently to check billing information for an assumed user?
https://docs.stripe.com/api/invoices/create_preview
https://docs.stripe.com/api/invoices/upcoming

twin bough
#

They are very similar. preview invoice is a new API that Stripe added recently

violet glen
#

If so, should I use preview invoice?