#jesper_sepa-and-apple-pay-incomplete-subscriptions

1 messages ยท Page 1 of 1 (latest)

cunning shadowBOT
#

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

๐Ÿ“ 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.

misty spindle
#

Hi! There's no way to delay the events as far as I know; what are you trying to test by doing this?

solar patrol
#

I want to see when the user receives the rewards from my subscription

#

Like if it receives them right away or only after the event

misty spindle
#

What rewards?

solar patrol
#

We disable ads and add some in game perks while the subscription is active

#

We don't use the Stripe entitlements API for reasons I can't exactly recall, but basically we check the status of the subscription to determine whether we should give users perks or not

misty spindle
#

You don't store that locally?

solar patrol
#

Yeah we use webhooks for subscription updates and store its status in our database

misty spindle
#

Perfect, so you will know when the Subscription is active because you will update your own datastore from the event.

#

Whether that takes 0.1 seconds, or 0.1 months, your data will be correct once you handle the event (and presumably you're also listening for when they deactivate to reverse the process)

solar patrol
#

The thing I'm not sure about is - what is the status of the subscription during this 'pending' phase? We only reward the user when the status is active, past_due, paused and trialing.

misty spindle
solar patrol
#

Hmm that page mentions the status transitions from incomplete to active 'when the payment succeeds'. So does that mean the status might stay as incomplete for a couple of days with SEPA payments? I think customers generally expect to get access to their rewards once they finish checkout.

misty spindle
#

Yes, it would.

#

Wait one.

#

Or just give them the perks on Subscription creation, and only remove on payment failure / 'past_due' status.

solar patrol
#

Hmm yeah I think I might do that

misty spindle
#

It's zero-cost digital goods, right? So ... seems reasonable. ยฏ_(ใƒ„)_/ยฏ

solar patrol
#

The problem is that with payments from our express checkout element, the incomplete status actually indicates a failed apple pay payment. So in that case I don't want to give the perks yet.

#

But I can probably find some way around that

#

Alright, I'll try that then. Thanks!

misty spindle
#

It shouldn't?

#

OHHHH

#

That is one of the things it could mean.

#

OHHHHHHHH 2: That's actually not what that status means, that status just happens to represent that situation.

#

I.e., you're viewing that upside down.

solar patrol
#

Oh hmm

#

So far I've observed this:
We create a subscription on the server, right when the user confirms their apple pay payment, then the client calls stripe.confirmPayment()
But if the user loses their internet connection or some other reason, they might not call confirmPayment(). In that case the subscription gets stuck in an incomplete state for a day or two

#

So that would allow users to activate perks every two days without ever actually paying

#

Not sure if that makes sense haha

#

But I think the solution here is to just give perks for incomplete subscriptions when they were created using a stripe hosted checkout session, and to not do that for subscriptions created on the server

misty spindle
#

Or pull the latest_invoice to see why it's incomplete.

#

Because in the Apple Pay failed case, it's an unpaid Subscription with no Payment Method to use going forward; in the SEPA case, it's just not done being paid yet.

solar patrol
#

Ah even better!

#

Though if I'm going to do that, I could really use a way to simulate delayed sepa events haha

#

Hmm I think I might just manually ignore events in my webhook handler ๐Ÿค”

#

And maybe manually trigger it later

misty spindle
#

You could do that for testing, but again I'd ask what you're actually tesing there. ยฏ_(ใƒ„)_/ยฏ

solar patrol
#

Ah yeah I'd only do this during development of course

#

I mostly just want to test whether the rewards are received correctly during this phase

misty spindle
#

That flow is triggered by an event, right? And it doesn't really matter when that event comes in to test the flow, right?

#

Like, they get rewards when you update their status in your datastore, which you do as a result of a Stripe event, ya?

solar patrol
#

Yes exactly

#

I mean, I'm not entirely sure yet what my logic is going to look like once I implement this

#

Hmm yeah I'm not really sure what I'm trying to test yet I guess haha

misty spindle
#

No worries - It's far better to start with "I probably should do x" and then determine that you don't need to do x, because now you know why. ๐Ÿ˜‚

#

I mean, it's less efficient, and a little annoying :chortle: but ... arguably better from a quality perspective. ๐Ÿ™‚

solar patrol
#

Hehe yea

#

Alright I'll try the invoice approach then, and if I do need to test stuff I can probably ignore webhook events or something. But we'll see how that goes

#

Thanks for this! This was very helpful!

misty spindle
#

You're very welcome! Good luck, have fun, and we're here if you need us. ๐Ÿ™‚

cunning shadowBOT