#amanda688_best-practices

1 messages ยท Page 1 of 1 (latest)

pearl sierraBOT
somber pantherBOT
#

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.

pearl sierraBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1255605032896954368

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

pallid hedge
#

Hello

half jewel
#

Hi -- my other thread closed before I had a chance to discuss with the client and get back to it. I'm looking for any way to get a custom field on the FIRST invoice of a subscription without converting all our payment links/checkouts to API-driven

#

I can update objects via API, np, but the client wants to use the Dashboard to configure their checkouts

pallid hedge
#

Yeah that's not possible.

#

You can't set custom fields for Invoices generated by a Subscription without updating the Invoices themselves via the API when they are in draft and the initial Invoice for a Subscription never has a draft period -- it is finalized immediately.

half jewel
#

hmm, ok, and you can't regenerate the invoice, and you can't update the Customer object's invoice settings before the first invoice gets created

pallid hedge
#

Ah! Sorry

#

I forgot about custom_fields on the Customer

#

That should certainly work as long as you set that prior to creating the Subscription

#

However, are you using Stripe Checkout here?

#

And attempting to collect these custom fields during the Checkout Session?

half jewel
#

I'm using the checkout configured by the client via the Stripe UI. They don't want to use API-driven checkouts for most cases.

pallid hedge
#

Oh right you said Payment Links

half jewel
#

You can configure custom fields to collect in there, but I'm listening for the checkout.session.completed webhook, and immediately setting the Customer's invoice_settings.custom_fields to the data collected, but it appears that the first invoice is created before it gets updated.

pallid hedge
#

Yes that's correct

half jewel
#

Every other invoice works as expected

pallid hedge
#

The first Invoice is created/finalized as soon as the Checkout Session is created

half jewel
#

And if I'm understanding timing correctly, I guess I can't hook into the Checkout Session being created, because the user may not have filled in the field yet, is that correct?

pallid hedge
#

Yeah you can't influence the Checkout Session at all

half jewel
#

and I see that the Payment Link object also has invoice_creation.custom_fields but I think I run into the same issue, because I need the value for the field from the customer ๐Ÿคช

pallid hedge
#

Correct you would need it ahead of time

half jewel
#

hrm, I think I'm stuck then ๐Ÿ˜“

pallid hedge
#

So there is one workaround

#

But

#

It won't look like your customer is buying a Subscription

#

So what you would do is create a one-time payment and use invoice_creation.invoice_data.custom_fields to set custom fields on that initial Invoice. You would also save the collected PaymentMethod for future use and then when you receive the Webhook for a successful payment you then create the Subscription with a trial period until the next desired billing time (and set the relevant custom_fields for that as well)

half jewel
#

hmm, ok, it's good to know that that exists, but I worry a little bit about what language there might be on the checkout page surrounding a 1-time-payment

pallid hedge
#

Yep would be a bit confusing as won't look like a Subscription

#

You could add some custom stuff perhaps to clarify that

half jewel
#

yeah, that probably would not work for our clients ๐Ÿซ 

pallid hedge
#

But overall that is the only workaround I can think of

half jewel
#

I appreciate the help trying to figure this out

#

I think for now I'm just to tell them that we can't do it ๐Ÿ˜…

pallid hedge
#

Yeah sorry can't think of any way to accomplish this