---
title: Manually requesting reports
url: amazon-pay-reports/manually-requesting-reports.html
---

Settlement reports are automatically generated per settlement. Transaction reports and Sandbox Settlement reports *might* be created by a schedule (see managing report schedules section). 
Multicurrency reports (reportType `_GET_CSV_CUSTOM_OFFAMAZONPAYMENTS_MULTI_CURRENCY_PAYMENTS_DATA_`) do not support schedule creation.

It is als possible to manually request individual transaction, Sandbox Settlement reports and Multicurrency reports via the `Create Report` API.


<!-- prettier-ignore-start -->
* TOC
{:toc}
{::options toc_levels="3" /}

***
<!-- prettier-ignore-end -->

### Create Report

Submits a request to generate a report based on the `reportType` and date range specified.

#### Request

<div style="display:none" class="environmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/live/:version/reports"<br />
-X POST <br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-H "x-amz-pay-idempotency-key:AVLo5tI10BHgEk2jEXAMPLEKEY"<br />
-d @request_body<br />
</code>

</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/live/:version/reports"<br />
-X POST <br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-H "x-amz-pay-idempotency-key:AVLo5tI10BHgEk2jEXAMPLEKEY"<br />
-d @request_body<br />
</code>

</div>

#### Request body

```
{
    "reportType": "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_SANDBOX_SETTLEMENT_DATA_",
    "startTime": "2022-08-04T00-00-00Z",
    "endTime": "2022-08-04T23-59-59Z"
}
```

#### Sample Code

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-createReport" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-createReport" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-createReport" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-createReport" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-createReport">   
<div markdown="block">
```
<?php
    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );

    $headers = array('x-amz-pay-Idempotency-Key' => uniqid());

    try {
        $requestPayload = array(
            'reportType' => '_GET_FLAT_FILE_OFFAMAZONPAYMENTS_SANDBOX_SETTLEMENT_DATA_',
            'startTime' => '20220804T000000Z',
            'endTime' => '20220804T235959Z'
        );

        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->createReport($requestPayload);

        if ($result['status'] === 200) {
            // success
            $response = $result['response'];
            echo $response;
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (\Exception $e) {
            // handle the exception
            echo $e . "\n";
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-createReport">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Reports;
using Amazon.Pay.API.WebStore.Types;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public void CreateReport()
    {
        // init Headers
        var myHeaderKey = "x-amz-pay-idempotency-key";
        var myHeaderValue = Guid.NewGuid().ToString();
        var headers = new Dictionary<string, string> { { myHeaderKey, myHeaderValue } };

        // init Request Payload
        CreateReportRequest requestPayload = new CreateReportRequest(
            reportType: ReportTypes._GET_FLAT_FILE_OFFAMAZONPAYMENTS_SANDBOX_SETTLEMENT_DATA_,
            startTime: "20220804T000000Z", // Can also use DateTime.Now or any DateTime object value
            endTime: "20220804T235959Z" // Can also use DateTime.Now or any DateTime object value
        );

        // send the request
        CreateReportResponse report = client.CreateReport(requestPayload, headers);

        // check if API call was successful
        if (!report.Success)
        {
            // handle the API error (use Status field to get the numeric error code)
        }

        // do something with the result, for instance:
        Console.WriteLine(report.RawResponse);
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-createReport">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

// for generating an idempotency key
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;

        JSONObject requestPayload = new JSONObject();
        requestPayload.put("reportType", "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_SANDBOX_SETTLEMENT_DATA_");
        requestPayload.put("startTime", "20220804T000000Z");
        requestPayload.put("endTime", "20220804T235959Z");
        
        Map<String, String> header = new HashMap<String, String>();
        header.put("x-amz-pay-idempotency-key", UUID.randomUUID().toString().replace("-", ""));

        response = webstoreClient.createReport(requestPayload, header);
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-createReport">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    

const requestPayload = {
    reportType: "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_SANDBOX_SETTLEMENT_DATA_",
    startTime: "20220804T000000Z",
    endTime: "20220804T235959Z"
}

const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.createReport(requestPayload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-createReport-NESK" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-createReport-NESK" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-createReport-NESK" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-createReport-NESK" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-createReport-NESK">   
<div markdown="block">
```
<?php
    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'sandbox'       => false,
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );

    $headers = array('x-amz-pay-Idempotency-Key' => uniqid());

    try {
        $requestPayload = array(
            'reportType' => '_GET_FLAT_FILE_OFFAMAZONPAYMENTS_SANDBOX_SETTLEMENT_DATA_',
            'startTime' => '20220804T000000Z',
            'endTime' => '20220804T235959Z'
        );

        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->createReport($requestPayload);

        if ($result['status'] === 200) {
            // success
            $response = $result['response'];
            echo $response;
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (\Exception $e) {
            // handle the exception
            echo $e . "\n";
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-createReport-NESK">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Reports;
using Amazon.Pay.API.WebStore.Types;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            environment: Environment.Live,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public void CreateReport()
    {
        // init Headers
        var myHeaderKey = "x-amz-pay-idempotency-key";
        var myHeaderValue = Guid.NewGuid().ToString();
        var headers = new Dictionary<string, string> { { myHeaderKey, myHeaderValue } };

        // init Request Payload
        CreateReportRequest requestPayload = new CreateReportRequest(
            reportType: ReportTypes._GET_FLAT_FILE_OFFAMAZONPAYMENTS_SANDBOX_SETTLEMENT_DATA_,
            startTime: "20220804T000000Z", // Can also use DateTime.Now or any DateTime object value
            endTime: "20220804T235959Z" // Can also use DateTime.Now or any DateTime object value
        );

        // send the request
        CreateReportResponse report = client.CreateReport(requestPayload, headers);

        // check if API call was successful
        if (!report.Success)
        {
            // handle the API error (use Status field to get the numeric error code)
        }

        // do something with the result, for instance:
        Console.WriteLine(report.RawResponse);
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-createReport-NESK">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Environment;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

// for generating an idempotency key
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setEnvironment(Environment.LIVE)
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;

        JSONObject requestPayload = new JSONObject();
        requestPayload.put("reportType", "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_SANDBOX_SETTLEMENT_DATA_");
        requestPayload.put("startTime", "20220804T000000Z");
        requestPayload.put("endTime", "20220804T235959Z");
        
        Map<String, String> header = new HashMap<String, String>();
        header.put("x-amz-pay-idempotency-key", UUID.randomUUID().toString().replace("-", ""));

        response = webstoreClient.createReport(requestPayload, header);
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-createReport-NESK">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    sandbox: false,
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    

const requestPayload = {
    reportType: "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_SANDBOX_SETTLEMENT_DATA_",
    startTime: "20220804T000000Z",
    endTime: "20220804T235959Z"
}

const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.createReport(requestPayload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>

#### Response

Returns <a href="https://restfulapi.net/http-status-201-created" target="_blank" rel="noopener noreferrer">HTTP 201 status response code</a> if the operation was successful.

```
{
     "reportId": "A08439021T39K6DTX4JS8",
}
```


Use the `reportId` returned in the `Get Report` API to retrieve report status and the report document url to get the report content.