1
只是玩弄PayPal API,尝试实施Checkout Express,以便我可以接受信用卡,优先考虑那些没有PayPal账户的人,因此我设置了encoder["LANDINGPAGE"] = "Billing";
。使用PayPal Checkout Express时,是否可以通过SetExpressCheckout传递送货地址?
在我的应用程序的用户将从 被重定向到PayPal网站选择支付选项菜单,因此他们早就进入了他们的地址 到我的送货形式,反正是有使用CheckoutExpress时,这个地址传递给贝宝? 我试图用下面的值徒劳地测试,但似乎当用户 得到重定向信用卡细节入口页上的贝宝地址栏是空白的。 我可以通过GetExpressCheckout得到他们输入的地址,但这要比我试图实现的要点 要好。
public string ECSetExpressCheckoutCode(string returnURL,string cancelURL,string amount,string paymentType,string currencyCode)
{
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "seller_324454235454_biz_api1.isp.net.au";
profile.APIPassword = "135454354";
profile.APISignature = "An5ns1Kso7MWUSSDFggfdgdfGHHGDSddGnbHJgMVp-rU03jS";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "SetExpressCheckout";
// Add request-specific fields to the request.
encoder["RETURNURL"] = returnURL;
encoder["CANCELURL"] = cancelURL;
encoder["AMT"] = amount;
encoder["PAYMENTACTION"] = paymentType;
encoder["CURRENCYCODE"] = currencyCode;
encoder["LANDINGPAGE"] = "Billing";
encoder["PAYMENTREQUEST_0_SHIPTOSTREET"] = "345/3 Moomy St.";
encoder["PAYMENTREQUEST_0_SHIPTOCITY"] = "Umpa Lumpa";
encoder["PAYMENTREQUEST_0_SHIPTONAME"] = "Johnny Walker";
encoder["PAYMENTREQUEST_0_SHIPTOSTATE"] = "NSW";
encoder["PAYMENTREQUEST_0_SHIPTOZIP"] = "2673";
encoder["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"] = "AU";
encoder["PAYMENTREQUEST_0_SHIPPINGAMT"] = "56.00";
encoder["NOSHIPPING"] = "0";
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
string Response = decoder["ACK"] == "Success" ? decoder["TOKEN"]: "ERROR";
return Response;
}