Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
95 views
in Technique[技术] by (71.8m points)

Google Checkout - XML API associate callback serial number with original order

Via the XML API, how do you associate an Google Checkout callback serial number with the original order?

On the same line - What does the serial number in the "Option B - Submit a Server-to-Server Checkout API Request" section of the XML API doc correspond to (format: serial-number="981283ea-c324-44bb-a10c-fc3b2eba5707")? Does it relate to the serial sent by the callback URL (numeric-only)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The way I've done this in the past is using the <merchanrt-private-data> tag in the original cart, so something like:

<checkout-shopping-cart xmlns='http://checkout.google.com/schema/2'>
 <shopping-cart>
  <merchant-private-data>
   <merchant-note>[some secret about the cart on my system]</merchant-note>
  </merchant-private-data>
  <items>
   ...
  </items>
 </shopping-cart>
</checkout-shopping-cart>

Then, after Google has called back with a serial number, I use the Notification History API to retrieve the order details, which then includes my private data, something like:

<new-order-notification xmlns="http://checkout.google.com/schema/2" serial-number="[serial number from google]">
 <buyer-billing-address>
  ...
 </buyer-billing-address>
 <timestamp>...</timestamp>
 <google-order-number>...</google-order-number>
 <order-summary>
  <total-chargeback-amount currency="GBP">...</total-chargeback-amount>
  <google-order-number>...</google-order-number>
  <total-charge-amount currency="GBP">...</total-charge-amount>
  <total-refund-amount currency="GBP">...</total-refund-amount>
  <purchase-date>...</purchase-date>
  <archived>false</archived>
  <shopping-cart>
   <merchant-private-data>
    <merchant-note>[the secret about the cart from my system]</merchant-note>
   </merchant-private-data>
   <items>
   </items>
  </shopping-cart>
  <order-adjustment>
   ...
  </order-adjustment>
  <promotions />
  <buyer-id>...</buyer-id>
  <buyer-marketing-preferences>
   <email-allowed>false</email-allowed>
  </buyer-marketing-preferences>
  <buyer-shipping-address>
   ...
  </buyer-shipping-address>
  <order-total currency="GBP">...</order-total>
  <fulfillment-order-state>NEW</fulfillment-order-state>
  <financial-order-state>REVIEWING</financial-order-state>
 </order-summary>
 <shopping-cart>
  <merchant-private-data>
    <merchant-note>[the secret about the cart from my system]</merchant-note>
  </merchant-private-data>
  <items>
  </items>
 </shopping-cart>
 <order-adjustment>
  ...
 </order-adjustment>
 <promotions />
 <buyer-id>...</buyer-id>
 <buyer-marketing-preferences>
  <email-allowed>false</email-allowed>
 </buyer-marketing-preferences>
 <buyer-shipping-address>
  ...
 </buyer-shipping-address>
 <order-total currency="GBP">...</order-total>
 <fulfillment-order-state>NEW</fulfillment-order-state>
 <financial-order-state>REVIEWING</financial-order-state>
</new-order-notification>

I can then use the secret to match the orders up to the details I'd stored in the database previously.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...