我正在尝试将 Google Checkout 集成到我的 asp.net MVC(C#) 应用程序中。我正在尝试实现类似于 PayPal Express Checkout 的 Google Checkout。IE
- 选购产品
- 获取授权令牌(通过登录 Google Checkout)并重定向到我的网站
- 使用从上一步获得的令牌从我的站点处理(收费)客户的帐户。
这将避免使用通知过程。是否可以使用 Google Checkout 实现相同的功能?请建议
我正在尝试将 Google Checkout 集成到我的 asp.net MVC(C#) 应用程序中。我正在尝试实现类似于 PayPal Express Checkout 的 Google Checkout。IE
这将避免使用通知过程。是否可以使用 Google Checkout 实现相同的功能?请建议
就像任何 API 一样,您必须相应地实现。
IPN
)从技术上讲,您可以使用Notification History API和charge
那些Chargeable
.
我终于通过使用 Google CheckOut 的 ParameterizedUrl 解决了这个问题。我这样做如下:
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);
}