#davemerritt-invoice

1 messages · Page 1 of 1 (latest)

unkempt gate
#

👋 Happy to help

#

Could you share the sample event ID (evt_xxx)?

weary matrix
#

evt_3LMNwxBhctil7qKd0Ec973u5

unkempt gate
weary matrix
#

This should all be happening in one flow so I'm confused as to when this would happen for the user. We provide the web view stripe integration and it pops up the "enter CC and pay" view or via apple pay. That should be the only step. When would this have been cancelled? Is this the credit card declining the payment after they hit submit?

#

I don't believe this is from the management portal we provide the user after they submit.

unkempt gate
#

This can be possible if customer decides to quit or stop at payment page that leaves the subscription unpaid.

weary matrix
#

we create a payment intent to generate the payment window, but then the subscription is not created until they hit submit so I'm confused how they can stop?

#

and in these cases we are receiving paymentResult === PaymentSheetEventsEnum.Completed as true in the client.

unkempt gate
#

How do you generate a payment intent now?

weary matrix
#

The mobile client makes an XHR request to our backend servers which generate the payment intent and respond with the paymentIntent.clientSecret

#

We are using the capacitor plugin in the client which I believe wraps the native client integrations

unkempt gate
weary matrix
unkempt gate
weary matrix
#

Yes I believe we are doing this alraedy

#
subscription = stripe.Subscription.create(
            customer=customer.id,
            items=[
                {
                    "price": price_id,
                }
            ],
            payment_behavior="default_incomplete",
            expand=["latest_invoice.payment_intent"],
        )
        data = {
            "subscription_id": subscription.id,
            "client_secret": subscription.latest_invoice.payment_intent.client_secret,
        }
        return Response(data, status=status.HTTP_200_OK)
#

we return the client secret of the payment intent of the subscription

unkempt gate
#

It's indeed that the subscription is created at this point alongside with payment intent creation

#

So, it's possible that customer decides to quit or stop at payment page that leaves the subscription unpaid since subscription is created at this point

#

After you pass the payment intent to the frontend for payment collection, customer stops/quits and does not complete the checkout process

weary matrix
#

okay - makes sense, I must be handling the webhooks wrong

#

I set it up to receive subscription.updated (which should be the payment goes through?) and subscription.cancelled but I'm somehow registered it as paid in my system

#

but I don't see either event for that user

unkempt gate
#

Let me take a look at that subscription again

weary matrix
#

oooh got it, I wasn't looking for that status in the customer.subscription.updated event

#

thank you that explains the issue

#

Appreciate the help!

unkempt gate
#

No problem! Happy to help 🙂