Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7653171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:57:40+00:00 2026-05-31T11:57:40+00:00

This is the post cart method that I am using: public CheckoutRedirect submit(CreateOrderRequest sku)

  • 0

This is the post cart method that I am using:

public CheckoutRedirect submit(CreateOrderRequest sku) {
       CartPoster cartPoster = context.cartPoster();
        CartPoster.CheckoutShoppingCartBuilder cartBuilder = cartPoster.makeCart();

        Money unitPrice = new Money();
        unitPrice.setCurrency(sku.getCurrency());
        unitPrice.setValue(new BigDecimal(sku.getPrice()));

        String platformId = sku.getPlatformId().toString();

        AnyMultiple merchantPrivateData = new AnyMultiple();
        merchantPrivateData.getContent().add(platformId);

        MerchantCheckoutFlowSupport merchantCheckoutFlowSupport = new MerchantCheckoutFlowSupport();
        merchantCheckoutFlowSupport.setContinueShoppingUrl(sku.getContinueShoppingUrl());
        CheckoutShoppingCart.CheckoutFlowSupport checkoutFlowSupport = new CheckoutShoppingCart.CheckoutFlowSupport();

        checkoutFlowSupport.setMerchantCheckoutFlowSupport(merchantCheckoutFlowSupport);

        DigitalContent digitalcontent = new DigitalContent();
        digitalcontent.setDisplayDisposition(sku.getDisplayDisposition());
        digitalcontent.setDescription(sku.getDigitalContentDescription());

        Item item = new Item();
        item.setItemDescription(sku.getDescription());
        item.setItemName(sku.getName());
        item.setMerchantItemId(sku.getSkuId());
        item.setUnitPrice(unitPrice);
        item.setDigitalContent(digitalcontent);
        item.setQuantity(sku.getQuantity());

        cartBuilder.addItem(item);

        CheckoutShoppingCart checkoutShoppingCart = cartBuilder.build();
        checkoutShoppingCart.setCheckoutFlowSupport(checkoutFlowSupport);
        checkoutShoppingCart.getShoppingCart().setMerchantPrivateData(merchantPrivateData);
        return cartPoster.postCart(checkoutShoppingCart);
    }

This works fine and will output xml as this:

<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
    <shopping-cart>
        <merchant-private-data>1000</merchant-private-data>
        <items>
            <item>
                <digital-content>
                    <description>Description Goes Here</description>
                    <display-disposition>OPTIMISTIC</display-disposition>
                </digital-content>
                <item-name>Product Name</item-name>
                <item-description>Product Description Goes Here</item-description>
                <unit-price currency="USD">4.95</unit-price>
                <quantity>1</quantity>
                <merchant-item-id>87</merchant-item-id>
            </item>
        </items>
    </shopping-cart>
    <checkout-flow-support>
        <merchant-checkout-flow-support>
            <continue-shopping-url>http://www.example.com/success</continue-shopping-url>
        </merchant-checkout-flow-support>
    </checkout-flow-support>
</checkout-shopping-cart>

You will notice <merchant-private-data>1000</merchant-private-data>
If you look at the XML api tag reference for this element: http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Tag_Reference.html#tag_merchant-private-data

It states that this is a container for any well formed xml sequence and shows an example with an element within this:

<merchant-private-data>
   <merchant-note>my order number 76543</merchant-note>
</merchant-private-data>

When adding the the List member in AnyMultiple, its stated that it will accept a String (as in the case I have shown) or an Element. My problem is that I cannot for the life of me, add an Element to this list without encountering marshaling errors.

I want to create:

<merchant-private-data>
   <platform-id>1000</platform-id>
</merchant-private-data> 

Also, I am rather new to writing Java code. Has anyone been successful in doing this using this API?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:57:41+00:00Added an answer on May 31, 2026 at 11:57 am

    Am not a Java dev (am .Net), so forgive my ignorance ~

    You’ll have to programmatically create an XML element and its value/inner text and insert/add it.

    This wouldn’t be part of the Google Checkout API, it would be the XML framework that handles the (de)serilialization you are already using – e.g. in .Net Framework this would be System.XML

    I know it’s not as helpful as can be, so I hope this at least gives you a place to look/start.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my HTML form: <form action=cart.php method=post> <input type=hidden value=1
I currently have something like this: <form action=cart.php?action=update method=post name=cart id=cart> <input maxlength=3 value=25
I this post , I've seen this: class MonitorObjectString: public MonitorObject { // some
I have this method to post the value to the /store/add_to_cart <form action =
buy.php: <form action=cart.php method=post> <?php foreach($product['varieties'] as $variety): ?> <input style=width:10px; margin-left:9px; name=price[] type=checkbox
This post reference to the One Definition Rule. Wikipedia is pretty bad on explaining
This post on SO answers most of the questions I have (much thanks to
This post asks this question but doesn't really give an answer, so I thought
This post relates to this: Add row to inlines dynamically in django admin Is
This post started as a question on ServerFault ( https://serverfault.com/questions/131156/user-receiving-partial-downloads ) but I determined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.