PayPal SDK未预先填充帐单字段

本文关键字:单字段 字段 填充 SDK PayPal | 更新日期: 2023-09-27 17:57:43

我正在使用PayPal Merchant.NET SDKhttp://paypal.github.io/sdk/以实现快速结账。

下面的代码片段用于我的SetExpressCheckout调用。唯一预先填充的字段是电子邮件地址。有人知道做这件事的正确方法吗?BTW-PayPal账单屏幕有名字和姓氏字段,但API只有名字字段???

SetExpressCheckoutRequestType request = new SetExpressCheckoutRequestType();
SetExpressCheckoutRequestDetailsType ecDetails = new SetExpressCheckoutRequestDetailsType();
...
ecDetails.ReqConfirmShipping = "0";
ecDetails.NoShipping = "1";
ecDetails.AddressOverride = "1";
ecDetails.SolutionType = SolutionTypeType.SOLE;
PaymentDetailsType paymentDetails = new PaymentDetailsType();
CurrencyCodeType currency = CurrencyCodeType.USD;
paymentDetails.OrderDescription = "Test";
paymentDetails.OrderTotal = new BasicAmountType(currency, "1.00");
ecDetails.PaymentDetails.Add(paymentDetails);
ecDetails.PaymentAction = PaymentActionCodeType.SALE;
ecDetails.LandingPage = LandingPageType.BILLING;
ecDetails.BuyerEmail = "bob@smith.com";
AddressType address = new AddressType();
address.Name = "Bob";
address.Street1 = "123 somewhere st";
address.Street2 = "#32";
address.CityName = "Houston";
address.StateOrProvince = "TX";
address.PostalCode = "12345";
address.CountryName = "US";
address.Phone = "123-456-7890";
ecDetails.BillingAddress = address;
request.SetExpressCheckoutRequestDetails = ecDetails;

我已经玩了前3个设置显示,但它似乎没有帮助。电子邮件已填充,订单描述也很好。国家是根据我的测试帐户设置的,而不是地址

PayPal SDK未预先填充帐单字段

来源https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/

ADDROVERRIDE
(可选)确定PayPal页面是否应显示您在此SetExpressCheckout请求中设置的发货地址,而不是此买家的PayPal文件中的发货地址。在文件中显示PayPal街道地址不允许买家编辑该地址。它是以下值之一:

0–PayPal页面不应显示发货地址。

1–PayPal页面应显示发货地址。

字符长度和限制:1个单字节数字字符。

使用ecDetails.AddressOverride = 1;作为此的.NET SDK版本。

此外,您需要设置paymentDetails.ShipToAddress而不是ecDetails.BillingAddress填写账单地址需要设置PAYMENTREQUEST_0_SHIPTONAME等字段。这意味着你的第一个ecDetails.PaymentDetails必须有与其相关的地址。

对于设置用户名,它是一个字符串,应该是address.Name = "Bob Smith";