#Rita Ly

1 messages ยท Page 1 of 1 (latest)

fiery foxBOT
royal plume
#

Or get just list of reasons, even without invoices.

I'm using JS / typescript or python

low quest
#

You can list invoices by status with this endpoint

royal plume
#

but what about the reason why payment failed?

low quest
#

And then you could retrieve the payment intent on each invoice, they will each have a latest_charge property that shows info about the latest charge including the decline that it ran in to

night glade
#

Oh so that's how the list api's work?

#

So something similar to this can be redundant then?

royal plume
#

I tired curl with status but returns {}

#

could you provide me just simple curl example ? ๐Ÿ™๐Ÿป

night glade
#

did you use one of these values in curl?

royal plume
#
  -u rk_live_... : \โ€จ
-d status=uncollectible \ 
-d limit=3

status not allowed and also there's no field in response like latest_charge

low quest
#

Do you have a specific ID of an invoice that you would expect to show up there?

#

If you click on one in your dashboard the ID (in_123) will be in the URL

#

And those payment intents will have charges, the charges will have decline codes

royal plume
#

ok, but when I'm on invoice view I'm interested why the invoice wasn't paid - that info is visible on invoice (screen above)

#

I'd like to get the reason why payment failed

low quest
#

That page is pulling information from the payment intent and its charge

royal plume
#

okey! so how can I get this information via API ?

#

could you write me steps in that case, because e.g export invoices with all fields to csv also doesn't include that quite crutial information ?

#

๐Ÿ˜›

low quest
#

I think it might be easier to show this with one invoice. Can you copy the ID of the invoice from your screenshot (in_123)? That ID will be in the URL for that invoice's dashboard page

royal plume
#

in_1MsI3YKpJcQYpR3WdejICHxm

#

here ^^

low quest
royal plume
#

Ok, give me sec

#

why do I need Having the 'rak_charge_write' permission would allow this request to continue. write to read charge info?

low quest
#

It sounds like you are using a restricted key that doesn't have proper permissions. Unfortunately sometimes our error messages there are inaccurate

#

We are working to improve them there. You don't actually need write permissions. Likely that rak_charge_write includes read permissions that you need here and we picked that over rak_charge_read to include in the error message

royal plume
#

I can add myself any key, but quite strange that I need write permission to read ๐Ÿ˜› and I'm sure that our BI team has only read

low quest
#

You should only need read permissions. That error message is incorrect

royal plume
#

unexpected expand array ๐Ÿ˜›

#

(I added full access for testing)

#
{
  "error": {
    "message": "Invalid array",
    "param": "expand",
    "request_log_url": "https://dashboard.stripe.com/logs/req_R9Bhw4FwvlKdGj?t=1680530052",
    "type": "invalid_request_error"
  }
}
low quest
royal plume
#

no problem this param is no needed witout it I see the reason

low quest
#

With the expand argument from the second doc

#

So try something like this

  -u rk_....: \
  -d expand=['payment_intent.latest_charge']```
royal plume
#

aaaa