Gracias por tu visita. Esta página solo está disponible en inglés.

Migrate from MWS Reports

If you are consuming Amazon Pay reports via the Amazon Marketplace Web Services (MWS) Reports API, this guide will explain the details on migrating to the new Amazon Pay Reports APIs. Amazon Pay reports will still be available via MWS, independent of MWS Reports API deprecation times. Amazon Pay Reports will not be available via the SP-APIs. If you are migrating to Amazon Pay CV2 or already offering CV2 and leveraging MWS for reports, please consider migrating to the new APIs below.


General differences between MWS Reports and Amazon Pay Reports APIs

Category Amazon Pay Reports MWS Reports
Authentication The Amazon Pay Reports API facilitates the same gateway as the Amazon Pay Checkout Version 2 (CV2). You can use the same credentials to access your reports as you are using for your payment integration. MWS relies on MWS Access Key Id and Secrets. Amazon Pay CV2 does not require those credentials anymore.
SDKs Amazon Pay Reports APIs are integrated into the same Amazon Pay API SDKs as CV2. More details here. MWS Reports provides a standalone SDK, unrelated to any Amazon Pay product.
API The Amazon Pay Reports API follows a RESTful approach and uses JSON to structure requests and responses. MWS Reports API uses XML for requests and responses.
Report document retrieval Amazon Pay Reports returns a link to the document. The API to retrieve the report document for MWS returns the document.

Note: The actual report content and format do not change. You can continue processing the reports as before.


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.

For partners: Please reach out to your Amazon Pay Partner Manager or Solution Architect to understand which options are available to conveniently migrate merchants you support.


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.

MWS Operation: GetReportRequestList and GetReportRequestListByNextToken
Amazon Pay Operation: Get Reports

MWS Parameters Amazon Pay Parameters Notes
ReportTypeList reportTypes Please check the right strings for your report types here
RequestedFromDate createdSince UTC in ISO 8601 format.
RequestedToDate createdUntil UTC in ISO 8601 format.
ReportProcessingStatusList processingStatuses Status of the report, as defined in the ProcessingStatus enum.
NextToken nextToken Only usable without any additional parameter.

Note: Specifying nextToken with any other parameters will cause the request to fail.

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

MWS Operation: GetReport
Amazon Pay Operation: Get Report Document

MWS Parameters Amazon Pay Parameters Notes
ReportId reportDocumentId The reportDocumentId received from Get Reports.

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.