I am using Stripe payments for an upcoming integration and I have setup the Stripe CLI so I can communicate to my test setup using my terminal and this all works fine.
I am trying to run some reporting to retrieve some payout reconciliation data
stripe reporting report_types retrieve payout_reconciliation.itemized.5
This returns the following response
{
"id": "payout_reconciliation.itemized.5",
"object": "reporting.report_type",
"data_available_end": 1705276800,
"data_available_start": 1702944000,
"default_columns": [
"automatic_payout_id",
"automatic_payout_effective_at",
"balance_transaction_id",
"created",
"available_on",
"currency",
"gross",
"fee",
"net",
"reporting_category",
"description"
],
"livemode": false,
"name": "Itemized payout reconciliation",
"updated": 1705302416,
"version": 5
}
So I know my CLI is setup but I want to use the parameters to filter by start and end date - by doing the following
stripe reporting report_types retrieve payout_reconciliation.itemized.5 --interval_start=1702944000 --interval_end=1705276800
I am using the stripe reporting docs here - https://stripe.com/docs/reports/report-types/payout-reconciliation
When I run the following command with the start and end dates I get an error?
$ stripe reporting report_types retrieve payout_reconciliation.itemized.5 --interval_start=1702944000 --interval_end=1705276800
unknown flag: --interval_start
I am confused as the parameters appear to be correct according to the API documentation - what an I doing wrong?
The way the Report Run API works is you first 'create a report run' specifying the parameters of the run, and then later when the run is complete, you get a webhook and can then access the results.
You don't retrieve data for a given interval by simply passing parameters to a GET (retrieve
) call as in the examples you shared; instead you create (a POST request, create
) a Report Run for the given interval you're interested in and then get the report async.
Furthermore, the values are passed to parameters
, not at the top level:
https://stripe.com/docs/api/reporting/report_run/create#create_reporting_report_run-parameters-interval_end
So putting all that together:
stripe reporting report_runs create --report-type="payout_reconciliation.itemized.5" --data parameters[interval_start]=1702944000 --data parameters[interval_end]=1705276800
(as also seen in the example at https://stripe.com/docs/api/reporting/report_run/create?lang=cli#create_reporting_report_run-parameters-interval_end)
That creates the ReportingRun object, and when the requested data is available and the report is done, you can retrieve the results; see https://stripe.com/docs/reports/api#report-runs