Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to PII information with RDT token #4287

Open
Awenega opened this issue Nov 3, 2024 · 16 comments
Open

Access to PII information with RDT token #4287

Awenega opened this issue Nov 3, 2024 · 16 comments
Assignees

Comments

@Awenega
Copy link

Awenega commented Nov 3, 2024

Hi, i'm tring to retrieve the VAT number ID of a client. I've the PII role for Tax Invoice for my application.

I'm making the call for RDT token with this object:

restrictedResource = {"method": "GET", "path": f"/orders/v0/orders/{order_id}", "dataElements": ["buyerTaxInformation"]}

But the response is:

{'errors': [{'code': 'InvalidInput', 'message': 'Application does not have access to one or more requested data elements: [buyerTaxInformation]', 'details': ''}]}

Why I can't get the RDT token if I've the Tax Invoice PII role enabled?

@jawheral jawheral self-assigned this Nov 4, 2024
@jawheral
Copy link

jawheral commented Nov 4, 2024

Hi @Awenega,

The buyerTaxInformation is only available to the Turkey marketplace which is part of the EU region, did you make sure you are calling SP-API in the EU region?

Screenshot 2024-11-04 at 10 26 22

Best,
Jawher
Selling Partner Developer Services

@Awenega
Copy link
Author

Awenega commented Nov 4, 2024

Hi,

Yes, i'm calling sp-api in the EU region, but i'm using the IT marketplace. Since Is avaiable only for the TR marketplace, what should i use in order to get the VAT Number of a buyer for the IT marketplace?

@jawheral
Copy link

jawheral commented Nov 4, 2024

Hi @Awenega,

First, to rule out any issues you might have with Tokens API, can you try requesting with "dataElements": ["buyerInfo"]?

Regarding getting the Buyer VAT number, for sellers who are neither enrolled in VCS nor in VCS Lite, you should rely on Orders report and FBA Shipments Invoicing report.
These are: GET_ORDER_REPORT_DATA_INVOICING and GET_AMAZON_FULFILLED_SHIPMENTS_DATA_INVOICING.
When not enrolled, the seller should activate the order reports columns that are required for invoicing. This can be done from the column picker on Seller Central: https://sellercentral.amazon.co.uk/order-reports-and-feeds/column-picker?source=/order-reports-and-feeds/reports/ref=xx_orderrpt_dnav_xxon. Billing, Buyer tax identifiers (incl. Buyer VAT Number) can be activated on the page.

If the seller is enrolled in VCS Lite, please make sure to use VIDR reports to get the VAT number and all other data points needed for invoicing.
If the Seller is enrolled in VCS, where Amazon generates invoices automatically, please check the Amazon VAT Calculation Report.

Best,
Jawher
Selling Partner Developer Services

@Awenega
Copy link
Author

Awenega commented Nov 4, 2024

Hi Jawher,

thank you for the detailed explaination.

I'm not enrolled in VCS nor in VCS Lite, and for this reason I want to automatize the invoice generation by myself.

I've tried the report types that you suggested, but everytime i got this response:
{'errors': [{'code': 'Unauthorized', 'message': 'Access to the resource is forbidden', 'details': ''}]}

In particular, what I do is to request that type of report, than I retrive the reportDocumentId of the report and then, using an RDT token I get the document. I get the token using the following restrictedResource as object:
restrictedResource = {"method": "GET", "path": f"/reports/2021-06-30/documents/{reportDocumentId}"}

But the problem seems to happen before I can get the RDT token. It happen when i request the report with that type of report_value that you suggested, using the standard access token. I've checked that i've the PII role enable of Tax invoicing, so I don't understand where is the problem...

@jawheral
Copy link

jawheral commented Nov 4, 2024

Hi @Awenega,

Your usage of the Tokens API looks good to me.

Did you self-authorize your app again after it received the Tax Invoicing role?
If the authorization token you are currently using was created before the activation of the Tax Invoicing role, you need to re-authorize again.

If this doesn't work, I suggest that you contact Developer Support.

Best,
Jawher
Selling Partner Developer Services

@Awenega
Copy link
Author

Awenega commented Nov 4, 2024

Hi Jawheral,

I self-authorize my app again and now seems that it works. So it creates the request to generate the report.

But, now, the problem is that everytime that i request this kind of report, checking the status it goes from IN_QUEUE to IN_PROGRESS to CANCELLED.

The body that I use for the request is the following:

body['dataStartTime'] = 2024-10-19T22:00:00+00:00 (isoformat)
body['dataEndTime'] = 2024-11-04T18:56:21.418472+00:00 (isoformat)
body['marketplaceIds'] = ['APJ6JRA9NG5V4', 'A1RKKUPIHCS9HS', 'A1PA6795UKMFR9']
body['reportType'] = "GET_ORDER_REPORT_DATA_INVOICING

I usually use this body with the report of all orders without the PII (and it works).
I don't understand what's wrong with this request, since is it seems to be the same

@jawheral
Copy link

jawheral commented Nov 5, 2024

Hi @Awenega,

The GET_ORDER_REPORT_DATA_INVOICING can only be scheduled as per the documentation.
Screenshot 2024-11-05 at 09 54 00

Please follow this tutorial to learn more about scheduling and retrieving reports.

I hope this helps!

Best,
Jawher
Selling Partner Developer Services

@Awenega
Copy link
Author

Awenega commented Nov 5, 2024

Hi Jawher,

thank you for the informations.
Following the documentation, I'm scheduling this kind of report and I'm using AWS SQS in order to get the notification and check the processingStatus (using the Notification api i've created the subscription).

Unfortunately, I still not being able to correctly get the report. It always says CANCELLED:

{
  "notificationVersion" : "2020-09-04",
  "notificationType" : "REPORT_PROCESSING_FINISHED",
  "payloadVersion" : "1.0",
  "eventTime" : "2024-11-05T15:49:32.141Z",
  "payload" : {
    "reportProcessingFinishedNotification" : {
      "sellerId" : "***",
      "accountId" : "amzn1.merchant.o.***",
      "reportId" : "****",
      "reportType" : "GET_FLAT_FILE_ORDER_REPORT_DATA_INVOICING",
      "processingStatus" : "CANCELLED"
    }
  },
  "notificationMetadata" : {
    "applicationId" : "amzn1.sp.solution.****",
    "subscriptionId" : "****",
    "publishTime" : "2024-11-05T15:49:32.182Z",
    "notificationId" : "****"
  }
}

I also checked if I have other reports scheduled with the same report type, but it is not the case (i've cancelled all the scheduled report in order to have only this scheduled report)

The output of the getReportSchedule request to create the scheduled report is the following:

{'reportSchedules': [{
'reportType': 'GET_FLAT_FILE_ORDER_REPORT_DATA_INVOICING', 
'marketplaceIds': ['APJ6JRA9NG5V4'], 
'period': 'PT15M', 
'nextReportCreationTime': '2024-11-05T16:02:40+00:00', 
'reportScheduleId': '****'
}]} 

Also, from what I believe, there are two reasons why a report can result in CANCELLED status:

  • An explicit cancellation request before the report starts processing.
  • An automatic cancellation if there is no data to return.

I exclude the first one.
Instead, for the second one, should not be the case, since I've received many orders in the last days, so it should not be empty...

@jawheral
Copy link

jawheral commented Nov 5, 2024

Hi @Awenega,

I'm not able to tell what exactly could be causing the report to be Cancelled. We need more details to know the exact issue, please create a case with Developer Support providing all the necessary details such as the reportId, sellerId, marketplaceId,...

Feel free to share the support case number once you have it so we can track it.

Thank you for your understanding!

Best,
Jawher
Selling Partner Developer Services

@Awenega
Copy link
Author

Awenega commented Nov 5, 2024

Hi Jawher,

The case number is 10486330002, thank you very much for your help!

@Awenega
Copy link
Author

Awenega commented Nov 8, 2024

Hi @jawheral,

just an info about this problem. Is it possible to pass a start time and end time for a scheduled report as for a standard report?

I don't mean the period that specifies how often the report should be generated, but rather to a specific date range for which I want orders within the report.

Thank you

@jawheral
Copy link

jawheral commented Nov 8, 2024

Hi @Awenega,

Yes, you can provide the reportOptions for a scheduled report. This can be passed as part of CreateReportScheduleSpecification.

Best,
Jawher
Selling Partner Developer Services

@jawheral
Copy link

jawheral commented Nov 15, 2024

Hi @Awenega,

Do you have your tax settings and VAT numbers setup on Seller Central?

Best,
Jawher
Selling Partner Developer Services

@Awenega
Copy link
Author

Awenega commented Nov 15, 2024

Hi Jawheral,

Yes, I have setup my tax settings and VAT numbers on Seller Central (otherwise i couldn't sell on Amazon and also they could block my account).

The support reply to my case as following:

I already checked with the report owners. What happens is, that there is no data to be returned. Even if there are orders, no invoices were created. Remember that you need to configure the invoicing part from Seller Central (which is out of our scope).

But I don't understand why she is talking about "no invoices were created" since this reportType are for sellers who aren't enrolled in VCS/VCS Lite. It's obvious that there are no invoices created, since amazon does not create any invoices on my behalf and instead I am the one who manually creates them and attaches them on the order page for the business clients.

Thank you

@jawheral
Copy link

jawheral commented Nov 15, 2024

Hi @Awenega,

Let's try out the following:
1 - Cancel the current invoicing report schedule you created.
2 - Try the GET_FLAT_FILE_ORDER_REPORT_DATA_INVOICING. This report can be requested as follows using createReport and not createReportSchedule:

{
  "marketplaceIds": [
    "APJ6JRA9NG5V4"
  ],
  "reportType": "GET_FLAT_FILE_ORDER_REPORT_DATA_INVOICING",
  "dataStartTime": "2024-08-01T00:00:00.000Z",
  "dataEndTime": "2024-11-14T23:59:59.000Z"
}

Best,
Jawher
Selling Partner Developer Services

@Awenega
Copy link
Author

Awenega commented Nov 15, 2024

Hi Jawher,

As you suggested, I've cancelled the current invoicing report schedule and then I tried to request the GET_FLAT_FILE_ORDER_REPORT_DATA_INVOICING with createReport with the following body:

{'marketplaceIds': ['APJ6JRA9NG5V4'], 'dataStartTime': '2024-10-31T23:00:00+00:00', 'dataEndTime': '2024-11-15T20:25:35.905106+00:00', 'reportType': 'GET_FLAT_FILE_ORDER_REPORT_DATA_INVOICING'}

The report always gets cancelled... I still don't understand why. Surely it is because there is no data, but of course there should be (and lots of it)

I have a doubt, these reportTypes are also used for FBA orders in order to obtain the tax information of buyers, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants