When I began working, the module available was only able to get it's configuration from a conf file. You can now pass all the needed conf options to the new() call, so take your pick, when I refer to the conf options, I'll do so generally.
You probably want to start working on the GCO sandbox to begin with. If you haven't initiated your sandbox account yet, you'll need to visit http://sandbox.google.com/checkout/sell to do so (and use all fake information! use a fake EIN instead of SSN, there's less form to fill out). Then set up your config for the GCO with:
and everything else as you'd expect it to be.# -- Sandbox Server: BASE_GCO_SERVER = https://sandbox.google.com/checkout/cws/v2/Merchant/
You can find your MERCHANT_ID and MERCHANT_KEY by logging into your (sandbox) account, and hitting "Settings" and then "Integration". They're there in bold on the right. Make sure you use the *sandbox* ID and KEY with the *sandbox* BASE_GCO_SERVER and the *production* ID and KEY with the *production* server (I haven't given you all the relevant urls to the production servers, I will)
Now you're pretty close. You can also pretty much work right out of the sample code that came with the modules at this point (see ex 1, ex 2, and ex 3). My own method is usually to wrap up these "foreign functions" so I wrote a generic order_item sub, that will call the google functions, but maybe tomorrow.. who knows? That's here (which is mostly just ex 1 from above):
sub order_item { my ( $item, $opts ) = @_; my $config = $GCOSystemGlobalconf; my $checkout_flow; if( my $csurl = $opts->{continue_shopping_url} ) { $checkout_flow = Google::Checkout::General::MerchantCheckoutFlow +->new( continue_shopping_url => $csurl, ); } my $gco = Google::Checkout::General::GCO->new(config_path => $confi +g); my $cart = Google::Checkout::General::ShoppingCart->new( ( $checkout_flow ? ( checkout_flow => $checkout_flow ) : () ), expiration => "+1 month", private => "Simple shopping cart" ); my $gcoitem = Google::Checkout::General::MerchantItem->new( %$item +); $cart->add_item($gcoitem); my $response = $gco->checkout($cart); if( is_gco_error($response) ) { warn $response->string; return { error => $response->string }; } return { redir => $response }; }
After you placed your test order(s), login to the sandbox server to see what you can do with it. (Note that you won't be able to purchase anything from your seller account using the same google account, it will give you an error saying that you can't purchase from yourself. So use a different account when you're acting as a purchaser.)
Test this thoroughly, and tweak to your liking, and when you're ready to go live..
# -- Production Server: BASE_GCO_SERVER = https://checkout.google.com/ws/v2/Merchant/
And away you go.
Remember, transactions are free now, but 2008 will see them costing 2% + $0.20 per transaction. Info at https://checkout.google.com/seller/fees.html. There's some kind of deal for those who advertise too, you folks will have to sort that out on your own.
In reply to Getting Started with Google Checkout's perl suite by qbxk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |