使用 PayPal Checkout Express 时是不是可以通过 SetExpressCheckout 传递送货地址?

Posted

技术标签:

【中文标题】使用 PayPal Checkout Express 时是不是可以通过 SetExpressCheckout 传递送货地址?【英文标题】:Is it possible to pass a shipping address via SetExpressCheckout when using PayPal Checkout Express?使用 PayPal Checkout Express 时是否可以通过 SetExpressCheckout 传递送货地址? 【发布时间】:2012-01-29 00:53:00 【问题描述】:

只是在玩 PayPal API,尝试实现 Checkout Express,以便我可以接受信用卡,优先考虑那些没有 paypal 帐户的人,因此我设置了encoder["LANDINGPAGE"] = "Billing";

在我的应用程序中,用户将被重定向到 PayPal 网站 选择付款选项菜单,因此他们已经输入了他们的地址 在我的运输表格中,使用 CheckoutExpress 时是否可以将此地址传递给 PayPal? 我正在尝试使用以下值进行徒劳的测试,但似乎当用户 被重定向到 PayPal 上的信用卡详细信息输入页面,地址字段为空白。 我可以通过 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;
    

【问题讨论】:

【参考方案1】:

更新您的 API 版本。 PAYMENTREQUEST 仅适用于 65.3 及更高版本。这就是为什么它现在被忽略的原因。除此之外,您的请求似乎很好。

发件人:encoder["VERSION"] = "51.0";

收件人:encoder["VERSION"] = "84.0";

【讨论】:

以上是关于使用 PayPal Checkout Express 时是不是可以通过 SetExpressCheckout 传递送货地址?的主要内容,如果未能解决你的问题,请参考以下文章