简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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