#ares_api

1 messages ¡ Page 1 of 1 (latest)

woeful tinselBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1368806518983753748

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

echo glen
#

To retrieve the invoice associated with the charge object, you'll want to pass the charge's payment_intent to the List all payments for an invoice API [https://docs.stripe.com/api/invoice-payment/list#list_invoice_payments-payment-payment_intent], you can then obtain the invoice ID [https://docs.stripe.com/api/invoice-payment/object#invoice_payment_object-invoice] from the returned invoice payment objects.

stuck elbow
#

I see that but I am not able to get a work around for this. For example I am trying to do this

    {
      ...params
    }
  );

and then

 const { charge } = invoice;

what is the recommended way to handle these cases now in new api versions?

echo glen
#

I beleived I've already answered the exact question, Maybe you missed my previous message?

stuck elbow
#

So listing all invoice payments doesn't give me any charge details at all. See the link you shared, I don't see any charge related details in the invoice_payments response details

{
  "object": "list",
  "url": "/v1/invoice_payments",
  "has_more": false,
  "data": [
    {
      "id": "inpay_1M3USa2eZvKYlo2CBjuwbq0N",
      "object": "invoice_payment",
      "amount_paid": 2000,
      "amount_requested": 2000,
      "created": 1391288554,
      "currency": "usd",
      "invoice": "in_103Q0w2eZvKYlo2C5PYwf6Wf",
      "is_default": true,
      "livemode": false,
      "payment": {
        "type": "payment_intent",
        "payment_intent": "pi_103Q0w2eZvKYlo2C364X582Z"
      },
      "status": "paid",
      "status_transitions": {
        "canceled_at": null,
        "paid_at": 1391288554
      }
    }
  ]
}

Maybe I am missing something.

#

So my question would be, how can I get charge details like charge ID, currency, amount etc from the invoice payment?

echo glen
#

Ok, that's a different question. You want to know the associated payments associated to a invoice, am I right?

stuck elbow
#

yes that's correct

stuck elbow
#

okay that is what i was looking for.

#

Thank you Jack!