I am trying to integrate Google Checkout to my asp.net MVC(C#) application. I am trying to implement Google Checkout similar to PayPal Express Checkout. i.e.

  1. Shop the Products
  2. Get the Authorization token(by sign in to Google Checkout) and redirect to my site
  3. Process(Charge) the Customer's Account from my site using the token got from the previous step.

This will avoid the use of Notification process. Is it possible to implement the same using Google Checkout? Please suggest

有帮助吗?

解决方案 2

I finally solved this by using the ParameterizedUrl of Google CheckOut. I have done this as below:

GCheckout.Checkout.ShoppingCartItem shoppingCartItem = new GCheckout.Checkout.ShoppingCartItem();
    shoppingCartItem.Description = "Google Checkout Item";
    shoppingCartItem.Name = "Google Checkout Item";
    decimal _price = 0M;
    decimal.TryParse(amt, out _price);
    shoppingCartItem.Price = _price;
    shoppingCartItem.Quantity = 1;
    shoppingCartItem.MerchantItemID = "1";

    string returnURL = "http://localhost:50241/GCheckout/Success";
    string trackURL = "http://localhost:50241/GCheckout/Track";

    GCheckout.Checkout.CheckoutShoppingCartRequest checkoutShoppingCartRequest = new GCheckout.Checkout.CheckoutShoppingCartRequest(ConfigurationManager.AppSettings["GoogleMerchantID"], ConfigurationManager.AppSettings["GoogleMerchantKey"], EnvironmentType.Sandbox, "USD", 30, false);
    checkoutShoppingCartRequest.ContinueShoppingUrl = returnURL;
    ParameterizedUrl trackingUrl = new ParameterizedUrl(trackURL + "?mid=123");
    trackingUrl.AddParameter("oid", UrlParameterType.OrderID);
    trackingUrl.AddParameter("ot", UrlParameterType.OrderTotal);
    trackingUrl.AddParameter("zp", UrlParameterType.ShippingPostalCode);
    checkoutShoppingCartRequest.ParameterizedUrls.AddUrl(trackingUrl);

    checkoutShoppingCartRequest.AddItem(shoppingCartItem);

    GCheckout.Checkout.MerchantCode merchantCode = new GCheckout.Checkout.MerchantCode();

    GCheckoutResponse response = checkoutShoppingCartRequest.Send();
    if (response != null)
    {
          Response.Redirect(response.RedirectUrl, true);
    }

其他提示

Just like any API, you have to must implement accordingly.

  • there is no (auto) redirect in Google Checkout/wallet that will somehow give you order data
  • Data exchange with Google Checkout API is in fact via Notifications which isn't part of the (browser/client) checkout flow (separate process - in Paypal speak this is similar to IPN)

You can technically "poll" for your orders using Notification History API and charge those that are Chargeable.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top