#austin_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1463635466086519019
đ 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.
- austin_api, 4 hours ago, 10 messages
You can change it on the subscription, but that would only set the application fee going forward. If you want to change the application fee on the first payment, you will need to update the first invoice's payment intent. Is updating the fee on the first payment your end goal here?
Hi Pompey. I would want to update it on the first and all future payments for that subscription
Gotcha, so the way you can do that is by expanding latest_invoice.payments on your subscription create call. That will give you the ID of the intent for the first payment at latest_invoice.payments.data[0].id on the object that is returned. Then when your user changes their selected PM you can make an update call on that payment intent on your backend and that will update the fee on the first payment. Once the payment completes successfully you can update the subscription's application fee percentage property so it is correct on future invoices.
Does that overall make sense to you?
Yup, that makes sense. So get the payment intent from the latest invoice and update the payment intents fields.
So the field im updating is app_fee_amount (for PI) and app_fee_percent (for the subscription, since there is no equivalent app_fee_amount field, or is there?)
Is it possible to update that field on the payment intent, then the subscription, THEN charge?
Yep, intents only have the amount property and subscriptions only have the percent. So you'll need to calculate both to set both properly here.
And yes, you can definitely update both before submitting the payment. I was just suggesting updating the intent only because that would be one less thing for the client to wait on when your server is asking it to change the fee.
Gotcha. So when I was playing around with it, I was running into issue with updating the app_fee_percent on subscription after it was created. Are there any restriction to editing this field on a subscription after its been created? Possibly something with it having an invoice that was already created with the old,initial app_fee_percent?
Can you tell me more about the issue? If you have the text of any error that we threw I can look in to that
Our API reference for that call doesn't mention a restriction on updating that field
one moment, i need to recreate the code
So when trying to update the App_Fee_Amount on a Payment Intent created from a subscription i get the following error:
Stripe.StripeException: Some of the parameters you provided (application_fee_amount) cannot be used when modifying a PaymentIntent that was created by an invoice. You can try again without those parameters.
Ah my apologies. In that case can you try updating application_fee_amount on the invoice? https://docs.stripe.com/api/invoices/update#update_invoice-application_fee_amount
I think that should work but the server is a bit too busy for me to test
Is this assumption correct?:
Recurring payments are made of 3 nested objects:
Subscription
|-> Invoice
|-> Payment Intent
One Time Payments
Just Payment Intent, no invoice or child objects
Yep that is right. The two things I'd add are:
- Invoice -> Payment Intent is can be a one to many relationship if you use partial payments
- Invoices can also be used for one-off payments if you want
I see. I'll try updating it via the Invoice and circle back if I run into any questions. Thanks Pompey!
Hi there - I'll be taking over for Pompey here if you have further questions
Is a payment intent still editable when its created via a subscription? Or will the invoice/PI be considered finalized by the point the PI is created and therefore not be editable?
What on the PaymentIntent do you want to change?
The application_fee_amount
The short answer is that it depends on how your Subscription is configured, and whether you are asking about the first Invoice or subsequent cycle Invoices. If you're using charge_automatically, the first Invoice is finalized and the PaymentIntent is confirmed immediately so you can't update the PaymentIntent
this doc is really helpful and I recommend having a look: https://docs.stripe.com/billing/subscriptions/overview#update-first-invoice