Closed marfitec closed 1 year ago
Something seems wrong with these reports.
@marfitec what makes you think that a RDT is needed? They do not include PII. Requesting them now yields a 403 since jan 2023.
@tusbar Thank you for the answer. Until January 2023 I was able to retrieve the GET_VAT_TRANSACTION_DATA report without any problems. Now not anymore. I get the message "forbidden". Why can't I request PII anymore and what does it mean I get 403? Is there another report that can be used to get information about the A/R invoices created by Amazon?
Regards Marcus
Hello @marfitec,
We have encountered the same issue since the 23rd of January, 2023. We haven't solved this yet, but I have found some things that might help.
The error we are getting (forbidden) means we don't have the correct permissions to perform the API call. Amazon introduced stricter roles related to data consumption in Amazon SP. To get the VAT report using the Amazon SP APIs, according to the documentation, you need to have Tax Invoicing (Restricted) role. If you scroll to the bottom of the page, you will see that this permission is required to get or create GET_VAT_TRANSACTION_DATA
reports. To update your roles, you need to go to the Data Access section of the Amazon developer profile.
This is not the only problem, though. @tusbar, to answer your question, the Tax Invoicing (Restricted) role is considered a restricted role containing Personally Identifiable Information (PII), which is why RDT is required. From what I understand, RDT is needed only when you get the report using the getReport
API, so it's unnecessary when you create it using the createReport
API.
Q: did you migrate from MWS to the SP APIs? Is your API application hybrid (i.e. can you use MWS and SP simultaneously)?
@evangelosdaniil thanks for your message.
I’ve just got an answer from a support case telling me that GET_VAT_TRANSACTION_DATA
reports now require the Tax Invoicing (Restricted) role.
It didn’t use to be the case, and it doesn’t make sense as that report does not expose any PII.
We did migrate from MWS, but the application hasn’t been hybrid for a few months.
Thank you for the update, @tusbar! This is really helpful!
+1 to what @tusbar said, closing this issue as the answer was provided thanks to @tusbar!
Hello all,
I have now added the Tax Accounting and Tax Transfer roles to the DeveloperAccount.
Unfortunately, I can't manage to create a restricted token for CreateReport. I don't know which dataElements I have to pass.
It doesn't work, a DocumentID is required, but I only have it after CreateReport.
{"restrictedResources":[{"method":"GET","path":"/reports/2021-06-30/reports","dataElements":[]}]}
That doesn't work either. { "restrictedResources": [ { }, "method": "GET", "path": "/reports/2021-06-30/reports", "dataElements": [ "buyerInfo", "paymentInfo" ] } ] }
Does anyone have an idea how I can now create and retrieve the GET_VAT_TRANSACTION_DATA using the RDT?
@evangelosdaniil @sungolivia
Same issue, I don't know what to put for dataElements:
async function createAndFetchVATTransactionDataReport(sellingPartner) { const reportType = "GET_VAT_TRANSACTION_DATA"; const marketplaceIds = ["A1PA6795UKMFR9"]; // German marketplace ID const dataStartTime = "2023-10-01T00:00:00Z"; // Start of October 2023 const dataEndTime = "2023-10-31T23:59:59Z"; // End of October 2023
try {
// Step 1: Create the Report with defined start and end times
const createReportResponse = await sellingPartner.callAPI({
operation: "createReport",
endpoint: "reports",
body: {
reportType: reportType,
marketplaceIds: marketplaceIds,
dataStartTime: dataStartTime, // Set start time for the report
dataEndTime: dataEndTime, // Set end time for the report
}
});
console.log(`Create report response:`, createReportResponse); // Log the create report response
const { reportId } = createReportResponse;
console.log(`VAT Transaction Data report created with ID: ${reportId}`);
// Step 2: Check Report Status and Get Report Document ID
let processingStatus = "IN_QUEUE";
let getReportResponse;
while (processingStatus === "IN_QUEUE" || processingStatus === "IN_PROGRESS") {
getReportResponse = await sellingPartner.callAPI({
operation: "getReport",
endpoint: "reports",
path: { reportId }
});
processingStatus = getReportResponse.processingStatus;
console.log(`Current processing status: ${processingStatus}`); // Log current status
console.log(`Get report response:`, getReportResponse); // Log the get report response
if (processingStatus === "IN_QUEUE" || processingStatus === "IN_PROGRESS") {
await new Promise(resolve => setTimeout(resolve, 1000)); // Check every second
}
}
if (processingStatus === "DONE") {
const reportDocumentId = getReportResponse.reportDocumentId;
console.log('reportDocumentId: ', reportDocumentId);
if (reportDocumentId) {
// Step 3: Create RDT Token
const rdtResponse = await sellingPartner.callAPI({
operation: "tokens.createRestrictedDataToken",
body: {
restrictedResources: [
{
method: "GET",
path: `reports/2021-06-30/documents/${reportDocumentId}`,
dataElements: ["buyerInfo", "buyerTaxInformation"]
}
]
}
});
console.log('token should follow');
console.log(`RDT response:`, rdtResponse); // Log the RDT response
const restrictedDataToken = rdtResponse.restrictedDataToken;
// Step 4: Fetch the Report Document with RDT
const getReportDocumentResponse = await sellingPartner.callAPI({
operation: "getReportDocument",
endpoint: "reports",
path: { reportDocumentId },
headers: {
"x-amz-access-token": restrictedDataToken
}
});
console.log('Report document details:', getReportDocumentResponse); // Log the report document response
} else {
console.log(`Report processing completed, but no document ID was provided. Status: ${processingStatus}`);
}
} else {
console.log(`Report processing did not complete successfully. Status: ${processingStatus}`);
}
} catch (error) { console.error('Error in creating and fetching VAT Transaction Data report:', error); } }
Hi,
I would like to retrieve the GET_VAT_TRANSACTION_DATA report. But for this a RDT token is needed. What do I need to set on the developer profile to retrieve this report? Or is there another report that I can use to retrieve outgoing invoice data (generated by Amazon)?
Greetings Marcus