#Alex Chartier-refund

1 messages · Page 1 of 1 (latest)

ruby rain
#

Apologies, I'm not sure I follow. Could you elaborate a bit on what you're trying to accomplish?

last flame
#

OK, so I set up my stripeClient with the appropriate secret apikey. I then create a session and place the session ID in the redirectToCheckout call of the button onclick method. When I get the callback from Stripe I retrieve the session information for the specific sessionID. This indicates a completed transaction.

#

When I later wish to perform a refund on this transaction it seems I need a charge ID. I am not sure where to get this.

ruby rain
#

Gotcha, so you can get the relevant charge ID by:

  1. Getting the associated Payment Intent ID from the Checkout Session:
    https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-payment_intent
  2. Retrieve the corresponding Charge's ID from the Payment Intent's charges.data field:
    https://stripe.com/docs/api/payment_intents/object#payment_intent_object-charges-data
last flame
#

Ah, OK. Should I be retrieving this info on the callback for additional validation of the completion status or is the status in the session itself sufficient?

ruby rain
#

The Session's status should be sufficient. If the Charge fails then the upstream objects won't move to a succeeded state.