简体   繁体   English

贝宝自适应付款结果

[英]Paypal adaptive payment result

I am new to paypal, the following code is my code 我是贝宝的新手,以下代码是我的代码

    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;

Now current what i did is, i used a simple button and assign the above to it. 现在我所做的是,我使用了一个简单的按钮,并将上面的内容分配给它。 But ended up when i click the button, it doesn't have any paypal lightbox pop up in order to let buyer pay payment. 但是最后当我单击按钮时,它没有弹出任何贝宝灯箱以便让买家付款。 May i know what i still lack of? 我可以知道我仍然缺少什么吗?

Ended up, I just have to get the paykey from the response, and redirect to the url of 最后,我只需要从响应中获取支付密钥,然后重定向到的网址即可

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

and everything will be right to do 一切都会做对的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM