I'd like to use google checkout to charge for subscriptions to my website. In order to efficiently process orders, I need to collect the purchaser's email address or another unique id for that order, so that later I can activate their account.
Is there a wa开发者_StackOverflow中文版y to programmatically associate an id that I can generate at runtime with an order placed in google checkout?
If possible, I'd like to do this just by generating different html for the "buy now" button. If necessary, I can use the API.
Update: I see various mentions of merchant-item-id
, and when I create a button with Google's tools I can set that field statically. If there were a dynamic way to set merchant-item-id, that would be perfect. Any solutions like that?
Look in to the notification API: http://code.google.com/apis/checkout/developer/Google_Checkout_HTML_API_Notification_API.html
Changing the code of the buy now button wouldn't actually notify you if the order was completed - there'd be no way to determine if a user just loaded the buy now page, completed the payment, or if the payment was declined. With the notification api you can instantly activate the subscription only when payment is received. Of course, you have to write the script to receive the notification...
The only other option I see if changing the continue_url to somehow change the thank you page to include the id, but this is easy to fake.
The answer seems trivial now. Just throw:
<input name="shopping-cart.items.item-1.merchant-item-id" type="hidden" value="11235" />
into your BuyNow button code (or whatever form you're using to submit) with 11235 being any value you like.
精彩评论