Paypal自适应付款结果

时间:2015-08-15 07:53:43

标签: c# .net paypal paypal-adaptive-payments

我是paypal新手,以下代码是我的代码

    ReceiverList receiverList = new ReceiverList();
    receiverList.receiver = new List<Receiver>();
    Receiver secondaryReceiver = new Receiver((Decimal)1.00);
    secondaryReceiver.email = "platfo_1255170694_biz@gmail.com";
    receiverList.receiver.Add(secondaryReceiver);
    Receiver primaryReceiver = new Receiver((Decimal)2.00);
    primaryReceiver.email = "platfo_1255612361_per@gmail.com";
    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;

现在我所做的是,我使用一个简单的按钮并将上面的内容分配给它。但最终当我点击按钮时,它没有弹出任何paypal灯箱,以便让买家付款。我可以知道我还缺少什么吗?

1 个答案:

答案 0 :(得分:0)

结束,我只需从响应中获取付费密钥,然后重定向到

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

一切都是正确的