环境:C#.NET + Paypal SOAP API 版本:72.0
由于Paypal卖家保护策略要求商家必须提供一个发货地址 以下为我的代码:
- C# code
var expResponse = client.SetExpressCheckout(ref csh, new SetExpressCheckoutReq() { SetExpressCheckoutRequest = new SetExpressCheckoutRequestType() { SetExpressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType() { ReturnURL = returnurl, CancelURL = cancelurl, BuyerEmail = CustomerHandle.GetIdentityName(), PaymentDetails = new PaymentDetailsType[] { new PaymentDetailsType() { OrderTotal=OrderToal, PaymentDetailsItem=new PaymentDetailsItemType[] { new PaymentDetailsItemType { Amount = OrderToal, Number = "", Quantity = "1", Name =string.Format("#{0}#",orderNum) } }, PaymentAction=PaymentActionCodeType.Sale, ShipToAddress=new AddressType { Name=string.Format("{0} {1}",shippingaddr.FirstName,shippingaddr.LastName), Street1=shippingaddr.ADD1, Street2=shippingaddr.ADD2, CityName=shippingaddr.City, StateOrProvince=shippingaddr.State, PostalCode=shippingaddr.Postcode, //Country=countrycode, /*paypal文档中说Country是必要的*/ Country=CountryCodeType.NL, CountryName="Netherlands", Phone=shippingaddr.Postcode } } }, AllowNote = "0", cppheaderimage = ConfigurationManager.AppSettings["LOGOURL"], BrandName = ConfigurationManager.AppSettings["BrandName"], NoShipping = "0", /*此外设置为1总是返回错误,设置为0无错误*/ AddressOverride = "1", ReqConfirmShipping = "0" }, Version = API_VERSION } });
当AddressOverride(Paypal说明是调用传递的地址将覆盖客户paypal账户中的地址) 设置为1(覆盖)时,
Country(一个枚举类型)和CountryName(string类型) 无论传递什么
结果都会包含一个异常:
10731 Shipping Address Country Empty The field Shipping Address Country is required
但是AddressOverride设置为0时就不会出现这个错误,请问哪位大哥有碰到过的?
帮下忙
------解决方案--------------------
AddressOverride设置为0的意思是,,使用买家在paypal系统内的地址国家,设置为1,则使用你传递的地址和国家来覆盖掉paypal系统内的地址和国家。国家的参数名字能否检查是不是SHIPTOCOUNTRY, SHIPTOSTATE,SHIPTOCITY等等