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

时间:2011-12-28 08:49:11

标签: c# asp.net api paypal

只需使用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 个答案:

答案 0 :(得分:1)

更新您的API版本。 PAYMENTREQUEST仅适用于65.3及更高版本。这就是它现在被忽视的原因。除此之外,您的请求似乎没问题。

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

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