Phone number is not coming from the shipping address

Hi,

I have just Integrated the Amazon payment gateway. When I ma saving the order in my database, I need to save the shipping and billing address of my account, Which is saved in Amazon.

But when I tried to fetch this It is give blank string.

response.GetAuthorizationDetailsResult.AuthorizationDetails.AuthorizationBillingAddress.Phone

This is the code.

thank you

Hello,
When integrating the Amazon payment gateway and trying to fetch the shipping and billing address from the customer’s Amazon account, it’s important to ensure that you are using the correct API call and accessing the appropriate data fields. The code you provided seems to be accessing the Phone field of the authorization billing address. However, to retrieve the complete shipping and billing address, you may need to access other fields as well.

Here’s an example of how you can retrieve the shipping and billing address information using the Amazon Payments API with Python:

# Assuming you have the 'response' object from the Amazon Payments API

# Retrieve the billing address
billing_address = response.GetAuthorizationDetailsResult.AuthorizationDetails.AuthorizationBillingAddress

# Retrieve the shipping address
shipping_address = response.GetAuthorizationDetailsResult.AuthorizationDetails.AuthorizationShippingAddress

# Access specific fields of the address
billing_street = billing_address.PhysicalAddress.Street
billing_city = billing_address.PhysicalAddress.City
billing_state = billing_address.PhysicalAddress.State
billing_postal_code = billing_address.PhysicalAddress.PostalCode
billing_country = billing_address.PhysicalAddress.CountryCode

shipping_street = shipping_address.PhysicalAddress.Street
shipping_city = shipping_address.PhysicalAddress.City
shipping_state = shipping_address.PhysicalAddress.State
shipping_postal_code = shipping_address.PhysicalAddress.PostalCode
shipping_country = shipping_address.PhysicalAddress.CountryCode

Make sure to check the documentation or resources provided by Amazon for the specific API you are using to fetch the address information. Additionally, ensure that your integration has the necessary permissions and access to retrieve the customer’s address details from the Amazon payment gateway.