Vielen Dank für deinen Besuch. Diese Seite ist nur in Englisch verfügbar.

Downloading reports via the Amazon Pay Reports API

You can manually download settlement and transaction reports from Seller Central:

Settlement reports: click Payments from the Reports menu.
Transaction reports: click Payments Transactions Reports from the Reports menu.

Note that manually requested reports will also be returned in the response of Get Reports operation.


Step1: Authentication

If you are using one of the Amazon Pay CV2 API SDKs, your SDK handle authentication for you, using the same keys and credentials as for your payment integration.

If you are new to CV2 APIs and SDKs, please follow the Download the Amazon Pay SDKs and Get your Public Key ID sections of the official Amazon Pay integration guide.

In case you have to - or are preferring to - manually sign requests, please start by Getting your Public Key ID. Requests need to be singed with your keys for authentication. Please follow the guide to Signing Requests. The Amazon Pay Scratchpad (US, EU, JP) is also a great resource for this.


Step 2: Get a list of generated reports

The Get Reports API will return a list of reports including their metadata. The metadata includes the reportDocumentId. This identifier is required to retrieve the actual report document.

Operation: Get Reports

Request

Request parameters

Name Location Description
reportTypes
(optional)

Type: string (comma-separated list of ReportTypes)
Query Parameter List of types of reports requested.
processingStatuses
(optional)

Type: string (comma-separated list of ProcessingStatus)
Query Parameter A list of processing statuses used to filter reports.
createdSince
(optional)

Type: string (date-time ISO 8601)
Query Parameter The earliest report creation date and time for reports to include in the response, in ISO 8601 date time format. Reports are retained for a maximum of 90 days.

Default: 90 days
createdUntil
(optional)

Type: string (date-time ISO 8601)
Query Parameter The latest report creation date and time for reports to include in the response, in ISO 8601 date time format. Reports are retained for a maximum of 90 days.

Default: now
pageSize
(optional)

Type: number
Query Parameter The number of reports per page to return.
Minimum: 1
Maximum: 100

Default: 10
nextToken
(optional)

Type: string
Query Parameter A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getReports operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail.

Sample Code

Response

Returns HTTP 200 status response code if the operation was successful.

{
     "reports": [{
        "reportId": "A08439021T39K6DTX4JS8",
        "reportType": "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_SETTLEMENT_DATA_",
        "startTime":"20221118T150630Z",
        "endTime":"20221202T150350Z",
        "createdTime":"20221207T170826Z",
        "processingStatus": "COMPLETED",
        "processingStartTime":"20221207T170826Z",
        "processingEndTime":"20221207T170826Z",
        "reportDocumentId": "amzn1.tortuga.3.45ee712dc-3512-6cbd-ad71-ab3cb4cffef7.T3FKJJI01Y1E32"
     }]
}

Response parameters

Parameters Description
reports
Type: list<Report>
A list of report objects matching the search criteria.
nextToken

Type: string
Returned when the number of results exceeds pageSize. To get the next page of results, call getReports with this token as the only parameter.

All details for this API are available here. If you are using a SDK, please check the matching SDK documentation.


Step 3: Get the Report document

Returns the pre-signed S3 URL for the report. The report can be downloaded using this URL.

Operation: Get Report Document

Request

Request parameters

Name Location Description
reportDocumentId
(required)

Type: string
Path Parameter Report Document identifier

Sample Code

Response

Returns HTTP 200 status response code if the operation was successful.

{
      "reportDocumentId" : "amzn1.tortuga.3.45ee712dc-3512-6cbd-ad71-ab3cb4cffef7.T3FKJJI01Y1E32",
      "url" : ""https://tortuga-[...].amazonaws.com/<reportDocumentId>?X-Amz-Algorithm=...&X-Amz-Signature=...",
      "compressionAlgorithm" : "N/A"
}

The Get Report Document API will return an url with the link to the report in zip format.

All details for this API are available here. If you are using a SDK, please check the matching SDK documentation.


Step 4: Download the report document file

You must download the report using the information returned in Step 3. The url is valid for 30 seconds only. At this time, all files will be uncompressed. The following sample code demonstrates how to download a plain text report document. You can also use the principles demonstrated in the sample code to guide you in building applications in other programming languages.

Use the following as inputs for the sample code:

  • The url and optional compressionAlgorithm values from the previous step are arguments for the url, and compressionAlgorithm parameters of the download method of the DownloadExample class.
package com.example.download;

import java.io.FileOutputStream;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;

public class DownloadExample {

    public static void main(String[] args){
        System.out.println("Downloading file");
        try (
            ReadableByteChannel readableByteChannel = Channels.newChannel(new URL("<url from GetReportDocument>").openStream());
            FileOutputStream fileOutputStream = new FileOutputStream("<target output file>")) 
        {
            fileOutputStream.getChannel().transferFrom(readableByteChannel, 0, Long.MAX_VALUE);
            fileOutputStream.close();
            System.out.println("Download complete");
        } catch(Exception e){
            System.err.println(String.format("error downloading: %s", e.getMessage()));
        }
    }

}
wget -O <target output file> "<url from GetReportDocument>"

Hint: Place the url in quotes to avoid issues with wget.