Querying reports metadata
In most cases the Get Reports API is all you need, as it contains the reportDocumentIdrequired to download the report document. If there is a need to get additional information about a specific report, use the Get Report By Id API.
Get Report By Id
Returns report details for the given reportId.
Request
curl "https://pay-api.amazon.com/live/:version/reports/:reportId"
-X GET
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
curl "https://pay-api.amazon.com/live/:version/reports/:reportId"
-X GET
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
Request parameters
reportId (required)
Type: string |
Path Parameter |
Report identifier |
Sample Code
<?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'
);
try {
$reportId = "A08439021T39K6DTX4JS8";
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->getReportById($reportId);
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";
}
?>
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.Reports;
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 GetReportById()
{
// 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
string reportId = "A08439021T39K6DTX4JS8";
// send the request
Report report = client.GetReportById(reportId, 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);
}
}
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;
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;
String reportId = "A08439021T39K6DTX4JS8";
response = webstoreClient.getReportById(reportId);
} catch (AmazonPayClientException e) {
e.printStackTrace();
}
}
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 reportId = 'A08439021T39K6DTX4JS8';
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.getReportById(reportId);
response.then(function (result) {
console.log(result.data);
}).catch(err => {
console.log(err);
});
<?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'
);
try {
$reportId = "A08439021T39K6DTX4JS8";
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->getReportById($reportId);
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";
}
?>
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.Reports;
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 GetReportById()
{
// 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
string reportId = "A08439021T39K6DTX4JS8";
// send the request
Report report = client.GetReportById(reportId, 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);
}
}
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;
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;
String reportId = "A08439021T39K6DTX4JS8";
response = webstoreClient.getReportById(reportId);
} catch (AmazonPayClientException e) {
e.printStackTrace();
}
}
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 reportId = 'A08439021T39K6DTX4JS8';
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.getReportById(reportId);
response.then(function (result) {
console.log(result.data);
}).catch(err => {
console.log(err);
});
Response
Returns HTTP 200 status response code if the operation was successful.
{
"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"
}