List Info

Thread: Level 2 Integration : buyButtonCart error




Level 2 Integration : buyButtonCart error
country flaguser name
United States
2007-02-25 16:42:15
Hi

I have just started playing with the google checkout. I want
to do Xml
API Level 2 Integration. Howver, I am unable to get past
this error.

Error
<?xml version="1.0"
encoding="UTF-8"?><error
xmlns="http://
checkout.google.com/schema/2"
serial-number="d0e8deac-856b-4be9-
bab0-210990cbd3cb">  <error-message>We were
looking for the parameter
"buyButtonCart", but we didn't find it in the cart
post; check your
form fields.</error-message></error>

I have attached  my program and setup information below.

Any response/suggestion is appreciated.

Thanks
yrg

Setup:
1. I configured by account to expect digital signatures.
2. I have'nt setup any call back server.
3. Sand box URL = https://sandbox.google.com/
checkout/cws/v2/Merchant/671846243569557/checkout/diagnose
4. I previously tried https://sandbox.google.com/cws/v2/Me
rchant/671846243569557/checkout/diagnose,
but recd a 302 from the server.


Here is my program:
ObjectFactory factory = new ObjectFactory();

        Money money = factory.createMoney();
        money.setCurrency("USD");
        money.setValue(new BigDecimal(159.99));

        Item item = factory.createItem();
        item.setItemDescription(">HelloWorld, the
simple MP3 player");
        item.setItemName("HelloWorld 2GB MP3
Player");
        item.setUnitPrice(money);
        item.setQuantity(1);

        ShoppingCart.Items items = new
ShoppingCart.Items();
        List<Item> itemList = items.getItem();
        itemList.add(item);

        ShoppingCart cart = factory.createShoppingCart();
        cart.setCartExpiration(null);
        cart.setItems(items);

        CheckoutShoppingCart checkoutCart = factory
                .createCheckoutShoppingCart();
        checkoutCart.setShoppingCart(cart);

        JAXBContext jaxbContext = JAXBContext
               
.newInstance("com.google.checkout.schema.two");
        Marshaller marshaller =
jaxbContext.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FRAGMENT,
                               Boolean.FALSE);

        StringWriter writer = new StringWriter();
        JAXBElement<CheckoutShoppingCart> e = new
JAXBElement<CheckoutShoppingCart>(
                new
QName("","checkout-shopping-
cart"),CheckoutShoppingCart.class,
                checkoutCart);
        marshaller.marshal(e,
                           writer);
        String data = writer.toString();

        String encodedData = CryptUtil.base64Encode(data);

        String signature =
CryptUtil.generateSignature(MerchantConstants.getMerchantKey
() ,data);

        String encodedSignature =
CryptUtil.base64Encode(signature);

        String strUri =
MerchantConstants.getCheckoutDiagnoseUrl();
        URL url = new URL(strUri);

        String response =
Transmitter.transmit(url,encodedData);
        System.out.println(response);


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "API Integration Basics" group.
To post to this group, send email to
google-checkout-api-integrationgooglegroups.com
To unsubscribe from this group, send email to
google-checkout-api-integration-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/google-checko
ut-api-integration?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )