#castle9000.pi-off-session-field

1 messages · Page 1 of 1 (latest)

junior forum
strong lotus
#

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.

junior forum
#

Thanks for the additional context .Can you share the ID of an affected Payment Intent?

strong lotus
#

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

junior forum
#

Thanks! Having a look

strong lotus
#

I'm guessing there isn't a field that does that

#

something like a is_off_session doesn't seem to exist

junior forum
#

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?

strong lotus
#

yeah invoice.payment_action_required and invoice.payment_action_required

junior forum
#

Ah, gotcha. My bad

strong lotus
#

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

junior forum
#

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

strong lotus
#

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

junior forum
#

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

strong lotus
#

thanks @junior forum that's fantastic

junior forum
#

Np!