English 中文(简体)
Look up the refund amount given a payment intent via Stripe s API
原标题:

How can I look up the amount refunded for a given payment intent in Stripe via API call?

Let s say I have a payment intent (pi_3NnXXYKI47gqqtmf0eR178Es), how can I check if it has been fully or partially refunded and by how much?

Using the stripe cli, I see there is a latest_charge property:

stripe payment_intents retrieve pi_3NnXXYKI47gqqtmf0eR178Es
{
  "id": "pi_3NnXXYKI47gqqtmf0eR178Es",
  "object": "payment_intent",
  "amount": 2500,
  "amount_capturable": 0,
  "amount_details": {
    "tip": {}
  },
  "amount_received": 2500,
  "application": null,
  "application_fee_amount": 500,
  "automatic_payment_methods": null,
  "canceled_at": null,
  "cancellation_reason": null,
  "capture_method": "automatic",
  "client_secret": "pi_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "confirmation_method": "automatic",
  "created": 1694053104,
  "currency": "usd",
  "customer": "cus_OTWo2r0gDDcyoj",
  "description": null,
  "invoice": "in_1NnXn3KI471qqtmftliLpC1g",
  "last_payment_error": null,
  "latest_charge": "ch_3NuInYKx47gqotmf0Rp7uWyX",
  "livemode": false,
  "metadata": {},
  "next_action": null,
  "on_behalf_of": "acct_1Nm3Xy2eoonJLRTG",
  "payment_method": "pm_10gZ42Kp47gqqtmfT4SWIXKK",
  "payment_method_options": {
    "card": {
      "installments": null,
      "mandate_options": null,
      "network": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "processing": null,
  "receipt_email": "bob@example.com",
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "status": "succeeded",
  "transfer_data": {
    "destination": "acct_1Nm3r22eNoJJVRTG"
  },
  "transfer_group": "group_pi_3NnXnkXI47gqqtmf0eRI78Es"
}

I can then look up the "latest charge" via the cli like so:

stripe charges retrieve ch_3NuInYKx47gqotmf0Rp7uWyX
{
  "id": "ch_3NuInYKx47gqotmf0Rp7uWyX",
  "amount_refunded": 1500,
  ...
}

Is this approach reliable? Is it possible that the payment intent has a charge that has a refund and is NOT the latest charge? The API documentation was sparse for the latest_chage property.

Any pointers are welcome!

问题回答

暂无回答




相关问题
How to Build an app with angular and stripe-connect

I wanna build a simple app that accept payments and then payout to the users I just wanna know how to do that Using the following technologies Angular Firebase stripe-connect Unfortunately, there ...

ReactJS + Stripe: trial_period_days not functioning

trial_period_days: 7 does not seem to be recognised in my node function. Any idea why this may be the case? Am I missing a variable? When posting to this it causes an integration error... const ...

Why React Stripe CardElement not rendering?

I was coding a project using React. It s been 3 days I ve looking for a solution. I learned to code and tried to integrate the stripe payment option on my web app. However, unable to get the proper ...

热门标签