1

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 way 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?

Riley Lark
  • 20,660
  • 15
  • 80
  • 128

2 Answers2

0

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.

sdcoder
  • 496
  • 2
  • 4
  • I'm not worried about anyone faking the number - the only thing they could do is pay for someone else's account. The continue_url option is interesting, but I'd be worried about the payment flow getting disrupted somehow between payment and redirecting to continue_url - in that case I'd have no idea what this order was for. Thanks for the link, but I don't see a way to use the notification api to attach a unique id to orders as they're being made. – Riley Lark Jan 04 '11 at 16:48
0

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.

Riley Lark
  • 20,660
  • 15
  • 80
  • 128