#Julien

1 messages · Page 1 of 1 (latest)

slim cypressBOT
cold rock
uneven stratus
#

exactly!

cold rock
#

Can you share the event ID (evt_xxx) that you're comparing it with and the response that you tried to retrieve the invoice?

#

If you're comparing the response with an old event, the values are likely to be different

uneven stratus
#

yes!

#

this is the event from 7th of september

#
{
  "object": {
    "id": "in_1LeSlxC8pVNfXauyLsNvTCKv",
    "object": "invoice",
    "amount_due": 434,
    "charge": "py_3LeTlbC8pVNfXauy1qz8RcCw",
    "currency": "eur",
    "customer": "cus_LhuRgBn0xlT0Da",
    "default_payment_method": null,
    "default_source": null,
    "number": "5E35DC6C-0020",
    "payment_intent": "pi_3LeTlbC8pVNfXauy1Xdq0eJU",
    "period_end": 1662336000,
    "period_start": 1662336000,
    "status": "paid",
    "subscription": "sub_1LeSlxC8pVNfXauySjnnMgOc",
    "total": 434,
    
...
  }
}
#

evt_1LfIYVC8pVNfXauy8oh113ru

#

basically, the information i need is the line item's subscription period, which is from septembre 5th (1662336000) to october 5th. How can I retrieve this?

sacred torrent
uneven stratus
#

ok great i will check that out, thank you!

#

Also, while I am at it, how could I avoid N+1 queries when iterating over invoices ? My sithation is, I need to iterate over all payments & refunds for a specific product in order to generate an accountability CSV file

#

Some information is in the invoice, some in the payment_intent, and some in the subscription and/or invoice line item

#

Is there a way to batch all my requests in one single request, and if so would you suggest to nest this request rather on the subscription api, on the invoice api or on the payment_intent api ?

sacred torrent
#

There is no batch request in Stripe APIs,

uneven stratus
#

Yes, I was thinking of the expand parameter. And can you nest an expanded object ? And can you expand objects within a collection ?

#

Never heard of the Reporting API before! I will have a look at it, thank you!

sacred torrent
slim cypressBOT