# -- Sandbox Server:
BASE_GCO_SERVER = https://sandbox.google.com/checkout/cws/v2/Merchant/
####
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 => $config);
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 };
}
####
# -- Production Server:
BASE_GCO_SERVER = https://checkout.google.com/ws/v2/Merchant/