amazon-pay-sdk-php icon indicating copy to clipboard operation
amazon-pay-sdk-php copied to clipboard

Full address and Name is not showing in the response of getOrderReferenceDetails

Open rohitpatil-tudip opened this issue 7 years ago • 10 comments

I want full selected address when the user selects any address from the address book. Following is the response what I got when "getOrderReferenceDetails" is executed.

{
    "GetOrderReferenceDetailsResult": {
        "OrderReferenceDetails": {
            "OrderReferenceStatus": {
                "State": "Draft"
            },
            "Destination": {
                "DestinationType": "Physical",
                "PhysicalDestination": {
                    "StateOrRegion": "Maharashtra",
                    "City": "Pune",
                    "CountryCode": "IN",
                    "PostalCode": "411057"
                }
            },
            "ExpirationTimestamp": "2018-01-03T11:27:29.805Z",
            "IdList": {

            },
            "SellerOrderAttributes": {
                "StoreName": "ZACK ACADEMY"
            },
            "OrderTotal": {
                "CurrencyCode": "USD",
                "Amount": "253.98"
            },
            "ReleaseEnvironment": "Sandbox",
            "SellerNote": "12-31-2020 - LEED Green Associate Exam Prep Online Anytime - Online, Live",
            "AmazonOrderReferenceId": "S01-4810502-0586824",
            "CreationTimestamp": "2017-07-07T11:27:29.805Z",
            "RequestPaymentAuthorization": "false"
        }
    },
    "ResponseMetadata": {
        "RequestId": "86c8e015-a182-4eca-b86f-b6c799ad6115"
    },
    "ResponseStatus": "200"
}

rohitpatil-tudip avatar Jul 07 '17 11:07 rohitpatil-tudip

Two thoughts

  1. make sure you're including payments:shipping_address in your scope
...
authorization: function () {
   loginOptions = {scope: 'profile payments:widget payments:shipping_address', popup: true};
   authRequest = amazon.Login.authorize(loginOptions, '{{route('amazon_login')}}');
},
...
  1. it's possible that's all the information that Amazon has in the wallet for that address.

pdbreen avatar Jul 07 '17 11:07 pdbreen

@pdbreen, Thanks for the quick reply,

Yes, It is already there in my code but still, it is not giving the address1, address2, name etc details.

rohitpatil-tudip avatar Jul 07 '17 11:07 rohitpatil-tudip

Here is the expected response that I want,


<GetOrderReferenceDetailsResponse 
   xmlns="http://mws.amazonservices.com/schema/OffAmazonPayments/2013-01-01">
  <GetOrderReferenceDetailsResult>
    <OrderReferenceDetails>
    <AmazonOrderReferenceId>S01-8474066-EXAMPLE</AmazonOrderReferenceId>
    <ExpirationTimestamp>2015-08-31T17:27:35.053Z</ExpirationTimestamp>
    <SellerNote>Thank you for your order.</SellerNote>
    <OrderTotal>
      <Amount>15.00</Amount>
      <CurrencyCode>USD</CurrencyCode>
    </OrderTotal>
    <IdList>
      <member>S01-8474066-2115738-EXAMPLE</member>
    </IdList>
    <OrderReferenceStatus>
      <LastUpdateTimestamp>
        2015-03-04T17:27:43.851Z
      </LastUpdateTimestamp>
      <State>Open</State>
    </OrderReferenceStatus>
    <Destination>
      <DestinationType>Physical</DestinationType>
      <PhysicalDestination>
        <Phone>800-000-0000</Phone>
        <PostalCode>60602</PostalCode>
        <Name>Susie Smith</Name>
        <CountryCode>US</CountryCode>
        <StateOrRegion>IL</StateOrRegion>
        <AddressLine2>Suite 2500</AddressLine2>
        <AddressLine1>10 Ditka Ave</AddressLine1>
        <City>Chicago</City>
      </PhysicalDestination>
    </Destination>
    <ReleaseEnvironment>Sandbox</ReleaseEnvironment>
    <Buyer>
      <Email>[email protected]</Email>
      <Name>Sandbox_tester</Name>
    </Buyer>
    <SellerOrderAttributes>
      <StoreName>Sandbox_test_app</StoreName>
    </SellerOrderAttributes>
    <CreationTimestamp>2015-03-04T17:27:35.053Z</CreationTimestamp>
    </OrderReferenceDetails>
  </GetOrderReferenceDetailsResult>
  <ResponseMetadata>
    <RequestId>181efc0d-a90b-429f-837e-1209bfe4da0e</RequestId>
  </ResponseMetadata>
</GetOrderReferenceDetailsResponse>

rohitpatil-tudip avatar Jul 07 '17 11:07 rohitpatil-tudip

Are you including the token passed to your logon handler as the address_consent_token in the call to getOrderReferenceDetails?

        $this->result = $this->client->getOrderReferenceDetails([
            'amazon_order_reference_id' => $orderReferenceId,
            'address_consent_token' => $token,
        ]);

pdbreen avatar Jul 07 '17 11:07 pdbreen

Yes! On the GUI widget it is showing address properly but in the API response, it is not showing all the details.

I want to access these address related details. Is there any other way to do this?

rohitpatil-tudip avatar Jul 07 '17 11:07 rohitpatil-tudip

Please check details. details

rohitpatil-tudip avatar Jul 07 '17 12:07 rohitpatil-tudip

I'd double check to make sure that address_consent_token being passed in is correct and the scope is being set properly. When its not supplied, you get partial shipping detail like you have.

https://pay.amazon.com/us/developer/documentation/apireference/201751970

pdbreen avatar Jul 07 '17 12:07 pdbreen

Here is my code, code

rohitpatil-tudip avatar Jul 07 '17 12:07 rohitpatil-tudip

Debug your $_POST values and I think you'll find the addressConsentToken is not set/missing. So, you'll need to go back to the amazon integration doc and figure out what step was missed. Anyway, it doesn't sound like there's any issue with this library.

pdbreen avatar Jul 07 '17 12:07 pdbreen

It looks like you are trying to pass the address consent token into a SetOrderReferenceDetails API call. Instead, make the GetOrderReferenceDetails API call with the same inputs.

Otherwise, everything that @pdbreen mentioned above is correct and should work.

islandskater43 avatar Jul 08 '17 15:07 islandskater43