Empty csv reports when trying to fetch stripe payout reports

Viewed 10

I am trying to get stripe payout reports by payout ID. I know that i have 5 options being itemized from 1 to 4 and a summary report.

I am following this flow for this: Running a report -> Retrieving the status of report to see if its successful -> If it is, use the file id provided by 2nd step to create a public file and send that link to client.

However, the final csv file i am getting from public url is empty apart from column names only.

For reference i am sharing some sample code:

const stripe = require('stripe')('stripe_key')
const func = async () => {
try {
    const responseData = await stripe.reporting.reportRuns.create(
        {
            report_type: 'payout_reconciliation.by_id.summary.1',
            parameters: {
                payout: 'payout_id',
            },
        },
        {
            stripeAccount: 'stripe_connected_acc',
        },
    )

    console.log(responseData)
  } catch (err) {
      console.log(err)
  }
}

const func2 = async () => {
try {
    const responseData = await stripe.reporting.reportRuns.retrieve(
        '{report id from previous function}',
        {
            stripeAccount: 'stripe_connected_acc',
        },
    )

    console.log(responseData)
   } catch (err) {
      console.log(err)
   }
}


const func3 = async () => {
try {
    const responseData = await stripe.fileLinks.create(
        {
            file: '{file id from previous function}',
        },
        {
            stripeAccount: 'stripe connected account',
        },
    )

    console.log(responseData)
  } catch (err) {
      console.log(err)
  }
}

I run these functions one after another and from third function i get the public file link. However the report csv is empty from this link.

Am i missing anything?

Thanks

0 Answers
Related