Search code examples
javagoogle-checkout

How can I correlate the response from Google Checkout to the correct order in the database?


When I get the notifications from google at the callback URL I am unable to correlate the messages to the correct order in the database. Can I pass some identifier that would be sent back to me as a part of the callback notification? How is this done in general?

I am using the latest google-checkout-java SDK.


Solution

  • You should be able to use your merchant-private-data-section for this

    <checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
      <shopping-cart>
        <merchant-private-data>
          <your-ref>019b1723a2754981ed5bc24e6ac9f501</your-ref>
        </merchant-private-data>
        [...]
      </shopping-cart>
    </checkout-shopping-cart>
    

    When you get the notification, you can read this data.

    See also this question and especially this answer. I'd only note additionally that you don't have to use merchant-note (or your-ref), but can define any tags of your own as merchant-private-data is defined as a sequence of xs:any. Hope that helps...