public static string GetCheckoutUrl(CheckoutOptions options, List <CheckoutItem> items) { try { var dict = options.GetAsKeyValue(true); for (int i = 0; i < items.Count; i++) { var itemDict = items[i].GetAsKeyValue(null); foreach (var keyValue in itemDict) { dict.Add(string.Format("Items[{0}].{1}", i, keyValue.Key), keyValue.Value); } } var checkoutUrl = string.Format(string.Concat(checkoutBaseUrlProd, "?{0}"), dict.ConvertToUriParamString()); if (options.UseSandbox) { checkoutUrl = string.Format(string.Concat(checkoutBaseUrlSandbox, "?{0}"), dict.ConvertToUriParamString()); } return(checkoutUrl); } catch (Exception ex) { throw ex; } }
public static string GetCheckoutUrl(CheckoutOptions options, CheckoutItem item) { try { var dict = options.GetAsKeyValue(false); item.GetAsKeyValue(dict); var checkoutUrl = string.Format(string.Concat(checkoutBaseUrlProd, "?{0}"), dict.ConvertToUriParamString()); if (options.UseSandbox) { checkoutUrl = string.Format(string.Concat(checkoutBaseUrlSandbox, "?{0}"), dict.ConvertToUriParamString()); } return(checkoutUrl); } catch (Exception ex) { throw ex; } }