#.stevenp

1 messages · Page 1 of 1 (latest)

unreal valveBOT
#

Hello! We'll be with you shortly. 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.

minor cloud
#

hello! you can't update the statement_descriptor suffix on a PaymentIntent created by an Invoice

main nexus
#

I dont see the suffix param on there

minor cloud
#

there's no suffix param there but you can update the entire statement descriptor

main nexus
#

ok, so updating the suffix param takes the Stripe shortened billing descriptor and appends * to it and then has that as the final descriptor. * is a restricted character however, so if I try to set the entire string directly on the statement descriptor I don't think it would work

#

We are currently actually doing it this way (just not using the * char) but for some reason when we update the entire billing statement on the invoice.created webhook, it does not end up updating the billingstatement on every charge object, only a portion of them, and were told to update it on the payment_intent as that's the correct place to do this

minor cloud
#

you mentioned it does not end up updating the billingstatement on every charge object, only a portion of them - can you share some examples here?

main nexus
#

yes

#

one moment

#

ch_3O7PrIAd9MgunUWe0qH2nicA -> this one failed to udpate the descriptor correctly

ch_3O7PenAd9MgunUWe00PiE29I -> this one updated the descriptor correctly

They are only a few seconds apart

minor cloud
#

gimme a while to look into this and get back to you

main nexus
#

kk tyvm

minor cloud
#

for the one that failed - from what I'm seeing, you updated the invoice at 2023-10-31 21:52:38 UTC (https://dashboard.stripe.com/logs/req_TKRGwXTXdTqFQY), but the invoice was already paid at (2023-10-31 21:52:26 UTC). Also, that's the first invoice for a Subscription which is paid via a Checkout Session. The invoice is finalized and paid immediately typically and there's no draft 1 hour period for you to modify the invoice

#

hmmm, it looks like the statement descriptor which you want to use is based off the invoice number also

#

For the second charge that worked, your application happened to be lucky enough to make the change to the statement descriptor before the customer made payment.

#

There's really no great workaround here for the first payment I'm afraid.

main nexus
#

how would one modify a billing statement for a payment that is created via checkout if not 😕

minor cloud
#

It's not about using payment_intent.created Right now it's dependent on luck i.e. whether you can update the invoice before the customer pays.

For the first invoice, using Checkout Sessions, it's impossible right because of how Checkout with mode=subscription works. There's just no parameter to pass in for the statement descriptor for the first invoice in the Checkout Session

main nexus
#

Ok, so the generally advised way to update the billing descriptor is to do it via the payment_intent object, per Stripe's docs, but in this case we cannot do it because the payment_intent is already created and it is being modified after the fact?

minor cloud
#

you cannot modify the PaymentIntent because the PaymentIntent is created by the Invoice

main nexus
#

Ah ok i see

#

I guess I'm confused - why is the Stripe docs saying to do it on the PaymentIntent?

minor cloud
#

that's for payments that are created with a PaymentIntent

main nexus
#

got it

main nexus
#

could we modify the payment_intent for all the checkout sessinos and then the invoices for all the non-checkout subscriptions?

minor cloud
#

Do you mean you have Subscriptions that are not created via Checkout Sessions?

main nexus
#

yea in theory. our use case is an app with merchants that could have all variations of payments. we're looking to implement a robust way of modifying the billing statement for any kind of charge that gets created for their account (i.e. checkout or not checkout, subscription vs one time etc.)

#

if we can't cover 100% of payment cases thats ok, but we'd like to get our coverage as high as possible

minor cloud
#

Statement descriptors are complicated. There's no one-size fits all solution here. It'll be easier for me to address specific issues that you're encountering.

#

Are you providing a service to only update the statement descriptor? Or will your service/app also help to create the payment / subscription?

main nexus
#

Only update the descriptor

main nexus
# minor cloud Statement descriptors are complicated. There's no one-size fits all solution her...

Could you provide a high level guide on how to update the descriptors to cover as many cases as possible?

Right now we listen to the invoice.created webhook and update it there, which seems to catch some cases

But for the checkout sessions it's unclear how we modify the billing_statement

Better yet, is there some way to globally set up the stripe account in a way where it uses the dynamic billing descriptors with the invoice numbers?

minor cloud
#

For Invoices, you'll want to listen for the invoice.created webhook. Whether or not the new statement descriptor applies is dependent if you manage to update it before the customer pays. There're certain situations whereby the first invoice will be immediately finalized and charged. There's no workaround for this for your service because you're not the one creating the Subscription / Invoice

#

Checkout Sessions first invoice for a Subscription is one such situation

#

Better yet, is there some way to globally set up the stripe account in a way where it uses the dynamic billing descriptors with the invoice numbers?

Unfortunately not. if you would like to see more support for such a feature, I'd suggest writing to https://support.stripe.com/contact/email to explain your use cases/feature request as that helps the product team capture demand for prioritisation

main nexus
#

perhaps it could be done on the customer.subscription.created?

minor cloud
#

there's no real difference really. When the subscription is created, the invoice.created event should also have been sent. You can check your webhook events and the time it was sent in your Dashboard.

#

The reason why I recommend using invoice.created is so that you'll only listen for that and cover all cases where an invoice is generated/used

main nexus
#

there's nothing that can be updated at the customer or the subscription level that tells stripe to use the suffix value for all charges?

And it looks like the subscription.created event fires before the invoice and the payment events

#

first event in the lifecycle is customer.subscription.created

minor cloud
#

you're changing the suffix for every invoice right?

main nexus
#

for each customer it will be the same suffix for every charge on that customer

#

so if we can change it at the customer level that would be sufficient

minor cloud
#

first event in the lifecycle is customer.subscription.created

You can look at the time it was sent. Also, we don't guarantee order of delivery of events

main nexus
#

we want the final billing statement to be
{{STRIPE_SHORTENED_DESCRIPTOR}}* INVOICE_NUMBER

main nexus
#

wouldnt the customer object have to exist within stripe's backend before it could create anything else though? so presumably we can at least guarantee this fires before the charge gets made?

main nexus
#

If we had some way to set the billing statement suffix reliably that would handle this, as Stripe by default when there's a billing_statement_suffix on the payment_intent will use the shortened descriptor set on the account + *

minor cloud
#

lets take a step back. you mentioned For each customer it will be the same suffix for every charge on that customer, yet at the same time, you mentioned you want {{STRIPE_SHORTENED_DESCRIPTOR}}* INVOICE_NUMBER.

The invoice number will change every invoice.

#

so it's not going to be the same for every customer

#

I'm a little confused about your requirements

main nexus
#

apologies, so on Stripe each invoice is of the form XXXXXXXX-DD where DD are two digits and the 8 alphanumeric characters are tied to the customer object

#

so each customer sees the same billing statement each time, it's tied to the invoice number, not the entire invoice id

#

invoice_prefix on the Customer object

#

so basically each statement is of the form

{{ACCOUNT.SHORTENED_BILLING_STATEMENT}}* {{customer.invoice_prefix}}

minor cloud
#

there's nothing that can be updated at the customer or the subscription level that tells stripe to use the suffix value for all charges

Not for your app.

Generally, how we determine the statement descriptor for the invoice for a Subscription is determined this way :

First off, we check if the current invoice that we’re charging for has a statement_descriptor property set or not. If there is one, we use it for the associated charge.

If there isn’t, we then look at the Product (for the Price). When you create a Product, you can set a custom statement descriptor that will be used on all invoices associated with it. When an invoice is created, if it doesn’t have a custom statement descriptor we take the one from the corresponding Product. If you have multiple Products, we take the statement descriptor associated with the first Price/Product in the list of items on the subscription, if any.

main nexus
#

Got it understood.

#

So presumably we just need some way of setting that statement_descriptor for every invoice for payments that have invoices, and for the other payments, we perhaps find some workaround

#

It should be doable to adjust the billing_statement for anything that is a subscription/rebill, as Stripe has time to generate the invoice prior to the charge, correct?

minor cloud
#

As long as it's not the first payment for a Subscription that is using collection_method=charge_automatically, there will be an ~1 hour interval before the invoice is finalized and paid

main nexus
#

yep got it, ty. this is an example of a customer that is on a subscription, however I am not seeing the invoice get created 1hr ahead

minor cloud
#

can you paste the invoice id here?

main nexus
#

it looks like it was due to a failed payment attempt actually and then it retried

#

I have to head to bed but TYSM for the help here

#

is it possible for me to reopen this thread tomorrow?

minor cloud
#

you can ask the new question in the main channel again. You can make reference (by pointing us) to the previous thread. We generally prefer to start a new thread after some time has passed

main nexus
#

ok roger that 👍