google-checkout

Google checkout merchant shipping calculation doesn't make sense


Google checkout is having an issue with dynamic merchant shipping callback calculation.

When customer click on the checkout with google button, I pass in the shipping method called "default shipping" and shipping cost is $100.

This default value will only show to customer when he selected shipping address and google callback to merchant site to fetch shipping method fail.

When customer login to google account and entered the shipping address (country/city/state/postcode...) , google will do an instant callback to merchant script to fetch the latest shipping method available.

I able to have google callback to me successfully, but my shipping method to google is not accepted.

Example,

When customer selected to ship to US NC, then:

but google say error below:

Merchant Calculations: We were looking for data in your merchant-calculation-results, but were not able to find it: result: address-id:209802946439880shipping-name: default shipping when fail

XML received from google instant callback:

<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-callback xmlns="http://checkout.google.com/schema/2" serial-number="abd99db3-d3e3-485b-ba9c-75863d02ed65">

  <shopping-cart>

    <merchant-private-data>
      <session-id>f199c97f7fa9b19ade6fa57a17ce79d61508aef4</session-id>
    </merchant-private-data>

    <items>
      <item>
        <item-weight value="0.0" unit="LB" />
        <tax-table-selector>food</tax-table-selector>
        <item-name>Test prod 3</item-name>
        <item-description></item-description>
        <unit-price currency="USD">1.0</unit-price>
        <quantity>1</quantity>
        <merchant-item-id>test11</merchant-item-id>
      </item>
    </items>

    <cart-expiration>
      <good-until-date>2011-05-20T23:59:59.000Z</good-until-date>
    </cart-expiration>

  </shopping-cart>

  <buyer-id>119687448728341</buyer-id>

  <calculate>

    <addresses>

      <anonymous-address id="209802946439880">
        <country-code>US</country-code>
        <city>Charlotte</city>
        <region>NC</region>
        <postal-code>28227</postal-code>
      </anonymous-address>

    </addresses>

    <shipping>
      <method name="default shipping" />
    </shipping>

    <tax>false</tax>

    <merchant-code-strings />

  </calculate>

  <buyer-language>English</buyer-language>

</merchant-calculation-callback>

XML to post to google after merchant script custom shipping calculation done:

<?xml version="1.0" encoding="UTF-8"?>
  <merchant-calculation-results xmlns="http://checkout.google.com/schema/2">
    <results>
      <result shipping-name="Fedex Economy" address-id="209802946439880">
        <shipping-rate currency="USD">15.20</shipping-rate>
        <shippable>true</shippable>
      </result>
    </results>
  </merchant-calculation-results>

So I suspect google must require me to return back the same default shipping name when I post back to google.

I tried it, if return the same default shipping name by modify the shipping amount, it works!

But when I return same default shipping name, at the same time an additional shipping method as FedEx Economy to google, google will reply error saying invalid extra data:

Merchant Calculations: You sent us invalid extra data in your merchant-calculation-results: [address-id: 209802946439880/shipping-name: Fedex Economy ]

<?xml version="1.0" encoding="UTF-8"?>
  <merchant-calculation-results xmlns="http://checkout.google.com/schema/2">
    <results>
      <result shipping-name="default shipping" address-id="209802946439880">
        <shipping-rate currency="USD">8</shipping-rate>
        <shippable>true</shippable>
      </result>
      <result shipping-name="Fedex Economy" address-id="209802946439880">
        <shipping-rate currency="USD">15.20</shipping-rate>
        <shippable>true</shippable>
      </result>
    </results>
  </merchant-calculation-results>

How come! Isn't it not practical to have this kind of rules...

When google pass back shipping city/state/postcode/country to me, my system will calculate and return available shipping method(s) only

It means before google let me know the address, I don't even know there is how many shipping method available for the particular customer.


Solution

  • That is how merchant calculated shipping works:

    REF: Merchant Calculations API -> Shipping

    You must specify a unique name and a default shipping cost for each shipping option.

    An alternative is for you to collect the zip code prior to sending your customer to Google Checkout. Your system can then pre-determine shipping availability and costs prior to redirecting your customer to Google and pass the shipping options/costs as "flat rate shipping" - this is just a Google Checkout specific term that means "here are the shipping costs for this order" (that you have already pre-calculated some way).

    More reference:

    1. Ok to ask for zip code
    2. More forum discussions

    Hope this helps...