Managing report schedules
The Report Schedule
APIs allow you to query, create or delete report schedules. Report Schedules allow you to request reports to be automatically created for you.
Use the Get Report Schedules
API to list all your current report schedules, the Get Report Schedule By Id
API to get details of an individual Report Schedule. The Create Report Schedule
and Cancel Report Schedule
APIs allow you to create or cancel report schedules.
Get Report Schedules
Returns report schedule details that match the filters criteria specified.
Request
curl "https://pay-api.amazon.com/live/:version/report-schedules"
-X GET
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
curl "https://pay-api.amazon.com/live/:version/report-schedules"
-X GET
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
Request parameters
Name | Location | Description |
---|---|---|
reportTypes (optional) Type: string (comma-separated list of ReportType) |
Query Parameter | List of report types |
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 {
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->getReportSchedules();
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 GetReportSchedules()
{
// 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
GetReportSchedulesRequest reportTypes = new GetReportSchedulesRequest();
// send the request
GetReportScheduleResponse report = client.GetReportSchedules(reportTypes, 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;
response = webstoreClient.getReportSchedules();
} 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 testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.getReportSchedules();
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 {
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->getReportSchedules();
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 GetReportSchedules()
{
// 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
GetReportSchedulesRequest reportTypes = new GetReportSchedulesRequest();
// send the request
GetReportScheduleResponse report = client.GetReportSchedules(reportTypes, 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;
response = webstoreClient.getReportSchedules();
} 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 testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.getReportSchedules();
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.
{
"reportSchedules": [
{
"reportScheduleId" : "68973459224",
"reportType" : "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_",
"scheduleFrequency" : "P1D",
"nextReportCreationTime": "20221118T150630Z"
}
]
}
Get Report Schedule By Id
Returns report schedule details for the given reportScheduleId
.
Request
curl "https://pay-api.amazon.com/live/:version/report-schedules/:reportScheduleId"
-X GET
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
curl "https://pay-api.amazon.com/live/:version/report-schedules/:reportScheduleId"
-X GET
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
Request parameters
Name | Location | Description |
---|---|---|
reportScheduleId (required) Type: string |
Path Parameter | Id of the report schedule |
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 {
$reportScheduleId = "68973459224";
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->getReportScheduleById($reportScheduleId);
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 GetReportScheduleById()
{
// 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 reportScheduleId = "68973459224";
// send the request
ReportSchedule report = client.GetReportScheduleById(reportScheduleId, 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 reportScheduleId = "68973459224";
response = webstoreClient.getReportScheduleById(reportScheduleId);
} 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 reportScheduleId = '68973459224';
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.getReportScheduleById(reportScheduleId);
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 {
$reportScheduleId = "68973459224";
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->getReportScheduleById($reportScheduleId);
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 GetReportScheduleById()
{
// 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 reportScheduleId = "68973459224";
// send the request
ReportSchedule report = client.GetReportScheduleById(reportScheduleId, 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 reportScheduleId = "68973459224";
response = webstoreClient.getReportScheduleById(reportScheduleId);
} 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 reportScheduleId = '68973459224';
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.getReportScheduleById(reportScheduleId);
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.
{
"reportSchedules": [
{
"reportScheduleId" : "68973459224",
"reportType" : "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_",
"scheduleFrequency" : "P1D",
"nextReportCreationTime": "20221118T150630Z"
}
]
}
Create Report Schedule
Creates a report schedule for the given reportType
. Only one schedule per report type allowed.
Request
curl "https://pay-api.amazon.com/live/:version/report-schedules"
-X POST
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
-H "x-amz-pay-idempotency-key:AVLo5tI10BHgEk2jEXAMPLEKEY"
-d @request_body
curl "https://pay-api.amazon.com/live/:version/report-schedules"
-X POST
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
-H "x-amz-pay-idempotency-key:AVLo5tI10BHgEk2jEXAMPLEKEY"
-d @request_body
Request parameters
Name | Location | Description |
---|---|---|
deleteExistingSchedule (optional) Type: boolean |
Query Parameter | If true deletes an existing report schedule for the given report type. The API returns an array, if a schedule for the given report type already exists and set to false .
Default: false |
reportType (required) Type: ReportType |
Body | Type of the report for the schedule |
scheduleFrequency (required) Type: ScheduleFrequency |
Body | Frequency in which the report shall be created. |
nextReportCreationTime (required) Type: string (date-time ISO 8601) |
Body | ISO 8601 time defining the next report creation time |
Request body
{
"reportType": "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_",
"scheduleFrequency": "P1D",
"nextReportCreationTime": "2022-08-06T23-59-59Z"
}
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'
);
$headers = array('x-amz-pay-Idempotency-Key' => uniqid());
try {
$requestPayload = array(
'reportType' => '_GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_',
'scheduleFrequency' => 'P1D',
'nextReportCreationTime' => '20220806T235959Z'
);
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->createReportSchedule($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";
}
?>
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 CreateReportSchedule()
{
// 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
CreateReportScheduleRequest requestPayload = new CreateReportScheduleRequest(
reportType: ReportTypes._GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_,
scheduleFrequency: ScheduleFrequency.P1D,
nextReportCreationTime: "20220806T235959Z", // Can also use DateTime.Now or any DateTime object value
);
// send the request
CreateReportScheduleResponse report = client.CreateReportSchedule(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);
}
}
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_ORDER_REFERENCE_DATA_");
requestPayload.put("scheduleFrequency", "P14D");
requestPayload.put("nextReportCreationTime", "20220806T235959Z");
Map<String, String> header = new HashMap<String, String>();
header.put("x-amz-pay-idempotency-key", UUID.randomUUID().toString().replace("-", ""));
response = webstoreClient.createReportSchedule(requestPayload, header);
} 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 requestPayload = {
reportType: "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_",
scheduleFrequency: "P1D",
nextReportCreationTime: "20220806T235959Z"
}
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.createReportSchedule(requestPayload);
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'
);
$headers = array('x-amz-pay-Idempotency-Key' => uniqid());
try {
$requestPayload = array(
'reportType' => '_GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_',
'scheduleFrequency' => 'P1D',
'nextReportCreationTime' => '20220806T235959Z'
);
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->createReportSchedule($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";
}
?>
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 CreateReportSchedule()
{
// 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
CreateReportScheduleRequest requestPayload = new CreateReportScheduleRequest(
reportType: ReportTypes._GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_,
scheduleFrequency: ScheduleFrequency.P1D,
nextReportCreationTime: "20220806T235959Z", // Can also use DateTime.Now or any DateTime object value
);
// send the request
CreateReportScheduleResponse report = client.CreateReportSchedule(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);
}
}
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_ORDER_REFERENCE_DATA_");
requestPayload.put("scheduleFrequency", "P14D");
requestPayload.put("nextReportCreationTime", "20220806T235959Z");
Map<String, String> header = new HashMap<String, String>();
header.put("x-amz-pay-idempotency-key", UUID.randomUUID().toString().replace("-", ""));
response = webstoreClient.createReportSchedule(requestPayload, header);
} 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 requestPayload = {
reportType: "_GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_",
scheduleFrequency: "P1D",
nextReportCreationTime: "20220806T235959Z"
}
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.createReportSchedule(requestPayload);
response.then(function (result) {
console.log(result.data);
}).catch(err => {
console.log(err);
});
Response
Returns HTTP 201 status response code if the operation was successful.
{
"reportScheduleId": "68973459224",
}
Cancel Report Schedule
Cancels the report schedule with the given reportScheduleId
.
Request
curl "https://pay-api.amazon.com/live/:version/report-schedules/:reportScheduleId" \
-X DELETE
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
curl "https://pay-api.amazon.com/live/:version/report-schedules/:reportScheduleId" \
-X DELETE
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-H "x-amz-pay-date:20201012T235046Z"
Request parameters
Name | Location | Description |
---|---|---|
reportScheduleId (required) Type: string |
Path Parameter | Report schedule 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 {
$reportScheduleId = "68973459224";
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->cancelReportSchedule($reportScheduleId);
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 CancelReportSchedule()
{
// 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 reportScheduleId = "68973459224";
// send the request
CancelReportScheduleResponse report = client.CancelReportSchedule(reportScheduleId, 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;
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;
String reportScheduleId = "68973459224";
response = webstoreClient.cancelReportSchedule(reportScheduleId);
} 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 reportScheduleId = "68973459224";
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.cancelReportSchedule(reportScheduleId);
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 {
$reportScheduleId = "68973459224";
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->cancelReportSchedule($reportScheduleId);
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 CancelReportSchedule()
{
// 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 reportScheduleId = "68973459224";
// send the request
CancelReportScheduleResponse report = client.CancelReportSchedule(reportScheduleId, 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;
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;
String reportScheduleId = "68973459224";
response = webstoreClient.cancelReportSchedule(reportScheduleId);
} 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 reportScheduleId = "68973459224";
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.cancelReportSchedule(reportScheduleId);
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.