2015-08-15 86 views
0

我是新來寶,下面的代碼是我的代碼貝寶自適應支付結果

ReceiverList receiverList = new ReceiverList(); 
    receiverList.receiver = new List<Receiver>(); 
    Receiver secondaryReceiver = new Receiver((Decimal)1.00); 
    secondaryReceiver.email = "[email protected]"; 
    receiverList.receiver.Add(secondaryReceiver); 
    Receiver primaryReceiver = new Receiver((Decimal)2.00); 
    primaryReceiver.email = "[email protected]"; 
    primaryReceiver.primary = true; 
    receiverList.receiver.Add(primaryReceiver); 

    RequestEnvelope requestEnvelope = new RequestEnvelope("en_US"); 
    string actionType = "PAY"; 
    string returnUrl = "https://www.facebook.com/"; 
    string cancelUrl = "https://www.facebook.com/"; 
    string currencyCode = "USD"; 
    PayRequest payRequest = new PayRequest(requestEnvelope, actionType, cancelUrl, currencyCode, receiverList, returnUrl); 
    payRequest.ipnNotificationUrl = "http://replaceIpnUrl.com"; 

    Dictionary<string, string> sdkConfig = new Dictionary<string, string>(); 
    sdkConfig.Add("mode", "sandbox"); 
    sdkConfig.Add("account1.apiUsername", "ryanano89-facilitator_api1.gmail.com"); 
    sdkConfig.Add("account1.apiPassword", "KNQ6M7MH3SJKVGQ8"); 
    sdkConfig.Add("account1.apiSignature", "AJ2gHJOSiReCgvozz1y4PVUNExXxA1jzzgOvl4pQaW6Ll2KWgHK6.hd3"); 
    sdkConfig.Add("account1.applicationId", "APP-80W284485P519543T"); 

    AdaptivePaymentsService adaptivePaymentsService = new AdaptivePaymentsService(sdkConfig); 
    PayResponse payResponse = adaptivePaymentsService.Pay(payRequest); 
    object dsa = payResponse.error; 

現在目前我所做的是,我用一個簡單的按鈕,並指定上面給它。但最終當我點擊按鈕,它沒有任何貝寶燈箱彈出爲了讓買家付款。我可以知道我還缺少什麼嗎?

+0

需要得到一個看看原始請求以及由此代碼產生的響應。我的猜測是,你根本不會按照你應該的方式重定向到PayPal。它不會那樣做。 –

回答

0

截止了,我只需要得到響應的paykey,並重定向到的

Response.Redirect("https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=" + payResponse.payKey); 

的URL,一切都將是正確的做