#dverleg_api

1 messages ยท Page 1 of 1 (latest)

hazy vineBOT
#

๐Ÿ‘‹ 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/1313580941700235357

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

sick ermineBOT
exotic sorrel
#

Hi ๐Ÿ‘‹ looking at the previous_attributes on evt_1QS1IyDoSXTg0Epxlgcapg77, I don't see status in that hash so it seems like the Subscription was already in a past due state before that Event. Taking a closer look.

remote knot
#

ah, I see that evt_1QS1IxDoSXTg0EpxpzvRaqXc already triggered that past_due I guess

#

Thanks by the way for the quick reply

#

At first the user subscribed to a 'free' Price. Afterwards, I add a paid Subscription Item via the API, while they have chosen iDeal for future payments. However, in this stream of events somewhere the Subscription gets set to 'past_due'. Might that be because the iDeal payment is not a direct one, and if so how could I fix that? Or am I missing something here?

exotic sorrel
#

Gotcha, so moving them from a free Subscription to a paid one triggers the Subscription to move to the next billing period, which then generates the next Invoice for the Subscription. I see the payment for that new Invoice is currently pending, since ideal/sepa are asynchronous payment methods.

#

I'm trying to remember whether it's expected for the Sub to go past_due while waiting for that payment to complete.

remote knot
#

I see, thanks. Thought something like that might be the case. But does that mean I cannot really use iDeal for this type of thing? I mean, I would be fine if they are charged in like 3-5 days through iDeal and keep the Subscription in 'active' state meanwhile instead of past_due

exotic sorrel
#

Since you aren't setting payment_behavior currently, does setting that to pending_if_incomplete adjust the status of the Subscription you see following the update request?
https://docs.stripe.com/api/subscription_items/create#create_subscription_item-payment_behavior
Doing so leverages this flow where the Subscription isn't updated until payment succeeds, and I'm thinking that might smooth things over here, though I'm not certain on that.
https://docs.stripe.com/billing/subscriptions/pending-updates

remote knot
#

I'll check that out right away

#

I actuall think that did solve it!

#

Looking at evt_1QS1gADoSXTg0EpxX3Ru9njZ

exotic sorrel
#

Woohoo! I do see that Sub is still active

remote knot
#

This also looks correct

#

I'll keep an eye out of the payment comes through at some point coming days

#

Hm, the strange thing I see now is that it did not actually add the Subscription Item at all to it

exotic sorrel
#

Nope, it doesn't get added to the Subscription until the payment completes. Until then the changes should be held in the pending_update hash on the Subscription object.

remote knot
#

that does seem to be empty on evt_1QS1gADoSXTg0EpxX3Ru9njZ, but strangely the items array does have the price I tried to add somehow. I think because req_ESjx5IugLJsG25 failed

exotic sorrel
#

Hm, I see the new Invoice was paid immediately because it was a zero-dollar invoice.

#

Oh, yeah, because the request to make the pending update failed, so nothing was updated.

remote knot
#

yes I think the first invoice was my iDeal verification

#

and then the second request failed because of the error mentioned

#

it would be great if the update does get through immediately, even though the payment will follow at a later stage. is that perhaps not a setting I could change somewhere or a different API field i'm missing

exotic sorrel
#

If you want the update to apply immediately then you should stop using pending_if_incomplete, and I think you'll need to be prepared to handle the past_due state. I'll try double checking with my teammates where that is expected.

remote knot
#

Thanks for clarifying & checking. Would it make sense to then use another payment method instead (like card?)? Would like to allow NL users to stay with iDeal, so if there is another way to keep that Subscription active or make it active again, that would be awesome.

#

some additional info, when I tried to remove the metadata (which caused the first error) and using that pending_if_incomplete once more - I got another error saying:
You cannot set payment_behavior to pending_if_incomplete when the default payment method is sepa_debit.
{
"payment_behavior": "pending_if_incomplete",
"price": "price_1PyCWrDoSXTg0EpxglMOeylt",
"quantity": "1",
"subscription": "sub_1QS1zBDoSXTg0EpxzarxNCiW"
}

#

on req_KvEKRwxoWoycPY

exotic sorrel
#

Ah, well that puts an even bigger hole in my plan on how to handle this more smoothly.

remote knot
#

๐Ÿ˜ unfortunately

exotic sorrel
#

I'll keep you posted on what my teammates share to see if there is a smooth way to handle this without needing to handle that past_due state.

remote knot
#

thanks a lot

exotic sorrel
#

As far as we can find the behavior you're seeing of Subscriptions going past_due while waiting for the ideal/sepa payment to clear seems expected.

remote knot
#

I'll see if I can figure out another way to make this work, thanks for the help so far