Is it possible to pass a shipping address via SetExpressCheckout when using PayPal Checkout Express?

孤街浪徒 提交于 2019-12-24 09:29:15

问题


Just playing around with the PayPal API, trying to implement Checkout Express so I can accept credit cards, prioritizing those who don't have a paypal account hence I set encoder["LANDINGPAGE"] = "Billing";.

In my application the user will be redirected to the PayPal site from the select payment option menu, hence they would have already entered their address into my shipping form, is there anyway to pass this address to PayPal when using CheckoutExpress ? I am trying in vain testing with the values below but it seems when user gets redirected the credit card details entry page on PayPal the address fields are blank. I can get the address they enter with GetExpressCheckout, but this beats the point of what I am trying to achieve.

    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:


Update your API version. PAYMENTREQUEST is only available at 65.3 and higher. That's why it's getting ignored now. Other than that your request appears fine.

From:
encoder["VERSION"] = "51.0";

To:
encoder["VERSION"] = "84.0";



来源:https://stackoverflow.com/questions/8653720/is-it-possible-to-pass-a-shipping-address-via-setexpresscheckout-when-using-payp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!