#castle9000.pi-off-session-field
1 messages · Page 1 of 1 (latest)
Hey! Have you tried setup_future_usage: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-setup_future_usage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hi, I think this is something different. In my case a payment method for the customer has already been setup earlier on in the month. When it comes to taking a payment when the user is not on our website and the payment fails, we'll like to listen for that webhook and send a notification of our own. The trouble is, if the user is on our site making an attempted payment we don't want to send a notification as they'll see an error messages anyway.
Thanks for the additional context .Can you share the ID of an affected Payment Intent?
Yeah so I'm using the stripe cli tool to create the test events. I have one with the event id of evt_1Jw1VRLEfeHdU4pE8mNvRPin and pi id payment_intent -> pi_3Jw1VOLEfeHdU4pE1nNepBUE and invoice id id -> in_1Jw1VLLEfeHdU4pEEHYPSWLC
Thanks! Having a look
I'm guessing there isn't a field that does that
something like a is_off_session doesn't seem to exist
setup_future_usage: 'off_session' is present on that PI object, as it was initiated via paying an invoice (generally an off-session scenario)
Is that not what you're looking for?
Ah, wait. Which events are you using again?
invoice.payment_action_required?
yeah invoice.payment_action_required and invoice.payment_action_required
Ah, gotcha. My bad
The payment method at this point as already been setup for off_session usage
I just need to know whether the payment is an off_session payment
Yeah there's no field on the Invoice object which will detail whether the payment was attempted on/off session. As stated that exists on the underlying Payment Intent, which isn't included with the Invoice object
However you can use the payment_intent field and make an additional request and then use the setup_future_usage field: https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok thanks, but maybe my interpretation of the setup_future_usage field is wrong. We're not setting up the payment method and at this point we've already setup the subscription for off_session usage. That presumably is always be true even if they're uprading their subscription on_session
we want to maybe sure we're only processing the events when the users is not on our site
when they're on the site we don't want to process the events
Got it. In that case I'd recommend perhaps setting something in the metadata field for specific on-session payments where you know the user is present
thanks @junior forum that's fantastic
Np!