2011-12-28 33 views
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; 
    } 

回答

1

更新您的API版本。 PAYMENTREQUEST僅適用於65.3及更高版本。這就是爲什麼它現在被忽略。除此之外,您的請求顯示正常。

來源:
encoder["VERSION"] = "51.0";

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

相關問題