Get authorization to access PII for order items in an order
Learn how to use the Tokens API to get authorization to access PII for order items in an order.
Learn how to use the Tokens API to get authorization to access PII for order items in an order. In this workflow you specify dataElements
=buyerInfo
to indicate that the RDT will authorize your application to access buyer information for the order items.
Prerequisites
To complete this tutorial, you need:
-
Authorization from the selling partner for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.
-
Approval for the following roles:
- Tax remittance. Required to access buyer information.
- Tax invoicing. Required to access buyer information.
Depending on your use case, you might need approval for only one of these roles. To learn more about roles and request access, refer to Registering as a developer and update your developer profile.
Step 1. Get an order ID
You need an order ID to identify an order for which you want order item information. You also need an order ID to get an RDT that authorizes your application to access buyer information for the order items. You can use the getOrders
operation of the Orders API to get a list of orders, from which you can get an order ID for the order that you are interested in.
-
Call the
getOrders
operation of the Orders API, specifying the appropriate parameters to filter for the order that you want.The operation returns orders that match your request. Each order includes an order ID.
-
From the orders that are returned, identify the order for which you want order item information.
-
Save the order ID for the order that you want, to use in Step 2. Get an RDT and Step 3. Include the RDT with a call to the
getOrderItems
operation.
Step 2. Get an RDT
Call the createRestrictedDataToken
operation to get an RDT. In the path
property of the restrictedResources
parameter, include the order ID from Step 1. Get an order ID. In this workflow we will specify the buyerInfo
value of the dataElements
parameter. This indicates that the RDT should provide authorization to access PII for use cases such as tax and gift wrapping.
-
Call the
createRestrictedDataToken
operation. -
Save the
restrictedDataToken
value (the RDT) to use in Step 3. Include the RDT with a call thegetOrder
operation.
Step 3. Include the RDT with a call to the getOrderItems
operation
getOrderItems
operationCall the getOrderItems
operation of the Orders API, specifying the order ID that you identified in Step 1. Get an order ID. Be sure to include the RDT from Step 1 in the x-amz-access-token
header of your call to getOrderItems
.
Updated about 11 hours ago