2017-01-14 1 views
0

Wir sind mit dem PayPal AdaptivePayments SDK seit einer Weile umleiten,302 URL zu paypal Startseite

Nun ist die gleiche URL wie vor ist der Kunden auf die PayPal-Homepage 50% der Zeit mit einer 302 temporären Umleitung Umleitung .

https://www.paypal.com/webscr&cmd=_ap-payment&paykey=XXXXXXXXXX.

der Code ist meist eine Kopie Vergangenheit von der paypal Probe

public override string CreateRedirectUrl(NameValueCollection parameters) 
{ 

    ReceiverList receiverList = new ReceiverList(); 
    receiverList.receiver = new List<Receiver>(); 

    PayRequest request = new PayRequest(); 
    RequestEnvelope requestEnvelope = new RequestEnvelope("en_CA"); 
    request.requestEnvelope = requestEnvelope; 
    request.feesPayer = "PRIMARYRECEIVER"; 
    //request.feesPayer = "SECONDARYONLY"; 

    Receiver receiver1 = new Receiver(); 

    if (parameters["amount1"] != null && parameters["amount1"].Trim() != string.Empty) 
    { 
     // Required) Amount to be paid to the receiver 
     receiver1.amount = Convert.ToDecimal(parameters["amount1"].ToString(), CultureInfo.InvariantCulture); 
    } 

    if (parameters["mail1"] != null && parameters["mail1"].Trim() != string.Empty) 
    { 
     // Receiver's email address. This address can be unregistered with 
     // paypal.com. If so, a receiver cannot claim the payment until a PayPal 
     // account is linked to the email address. The PayRequest must pass 
     // either an email address or a phone number. Maximum length: 127 characters 
     receiver1.email = parameters["mail1"]; 
    } 

    //if (parameters["primaryReceiver1"] != null && parameters["primaryReceiver1"].Trim() != string.Empty) 
    //{ 
    // receiver1.primary = Convert.ToBoolean(parameters["primaryReceiver1"]); 
    //} 

    receiver1.primary = true; 
    receiver1.invoiceId = parameters["invoiceId"]; 

    receiverList.receiver.Add(receiver1); 

    Receiver receiver2 = new Receiver(); 

    if (parameters["amount2"] != null && parameters["amount2"].Trim() != string.Empty) 
    { 
     // (Required) Amount to be paid to the receiver 
     receiver2.amount = Convert.ToDecimal(parameters["amount2"], CultureInfo.InvariantCulture); 
    } 

    if (parameters["mail2"] != null && parameters["mail2"].Trim() != string.Empty) 
    { 
     // Receiver's email address. This address can be unregistered with 
     // paypal.com. If so, a receiver cannot claim the payment until a PayPal 
     // account is linked to the email address. The PayRequest must pass 
     // either an email address or a phone number. Maximum length: 127 characters 
     receiver2.email = parameters["mail2"]; 
    } 

    //if (parameters["primaryReceiver2"] != null && parameters["primaryReceiver2"].Trim() != string.Empty) 
    //{ 
    // receiver2.primary = Convert.ToBoolean(parameters["primaryReceiver2"]); 
    //} 

    receiverList.receiver.Add(receiver2); 

    ReceiverList receiverlst = new ReceiverList(receiverList.receiver); 
    request.receiverList = receiverlst; 

    // (Optional) Sender's email address. Maximum length: 127 characters 
    if (parameters["senderEmail"] != null && parameters["senderEmail"].Trim() != string.Empty) 
    { 
     request.senderEmail = parameters["senderEmail"]; 
    } 

    // The action for this request. Possible values are: PAY – Use this 
    // option if you are not using the Pay request in combination with 
    // ExecutePayment. CREATE – Use this option to set up the payment 
    // instructions with SetPaymentOptions and then execute the payment at a 
    // later time with the ExecutePayment. PAY_PRIMARY – For chained 
    // payments only, specify this value to delay payments to the secondary 
    // receivers; only the payment to the primary receiver is processed. 
    //if (parameters["actionType"] != null && parameters["actionType"].Trim() != string.Empty) 
    //{ 
    // request.actionType = parameters["actionType"]; 
    //} 
    request.actionType = "PAY"; 

    // URL to redirect the sender's browser to after canceling the approval 
    // for a payment; it is always required but only used for payments that 
    // require approval (explicit payments) 
    if (parameters["cancelURL"] != null && parameters["cancelURL"].Trim() != string.Empty) 
    { 
     request.cancelUrl = parameters["cancelURL"]; 
    } 

    // The code for the currency in which the payment is made; you can 
    // specify only one currency, regardless of the number of receivers 
    if (parameters["currencyCode"] != null && parameters["currencyCode"].Trim() != string.Empty) 
    { 
     request.currencyCode = parameters["currencyCode"]; 
    } 

    // URL to redirect the sender's browser to after the sender has logged 
    // into PayPal and approved a payment; it is always required but only 
    // used if a payment requires explicit approval 
    if (parameters["returnURL"] != null && parameters["returnURL"].Trim() != string.Empty) 
    { 
     request.returnUrl = parameters["returnURL"]; 
    } 

    request.requestEnvelope = requestEnvelope; 

    // (Optional) The URL to which you want all IPN messages for this 
    // payment to be sent. Maximum length: 1024 characters 
    if (parameters["ipnNotificationURL"] != null && parameters["ipnNotificationURL"].Trim() != string.Empty) 
    { 
     request.ipnNotificationUrl = parameters["ipnNotificationURL"]; 
    } 

    AdaptivePaymentsService service = null; 

    try 
    { 
     // Configuration map containing signature credentials and other required configuration. 
     // For a full list of configuration parameters refer in wiki page 
     // (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters) 
     Dictionary<string, string> configurationMap = PaypalAdaptiveConfiguration.GetAcctAndConfig(); 

     // Creating service wrapper object to make an API call and loading 
     // configuration map for your credentials and endpoint 
     service = new AdaptivePaymentsService(configurationMap); 

     Response = service.Pay(request); 
    } 
    catch (System.Exception ex) 
    { 
     // contextHttp.Response.Write(ex.Message); 
     //return; 
    } 

    Dictionary<string, string> responseValues = new Dictionary<string, string>(); 
    string redirectUrl = null; 

    if (!Response.responseEnvelope.ack.ToString().Trim().ToUpper().Equals(AckCode.FAILURE.ToString()) && !Response.responseEnvelope.ack.ToString().Trim().ToUpper().Equals(AckCode.FAILUREWITHWARNING.ToString())) 
    { 
     if (ConfigurationManager.AppSettings["PAYPAL_MODE"].ToLower() == "live") 
     { 
      redirectUrl = ConfigurationManager.AppSettings["PAYPAL_REDIRECT_URL_LIVE"] + "_ap-payment&paykey=" + Response.payKey; 
     } 
     else 
     { 
      redirectUrl = ConfigurationManager.AppSettings["PAYPAL_REDIRECT_URL"] + "_ap-payment&paykey=" + Response.payKey; 
     } 
     // The pay key, which is a token you use in other Adaptive Payment APIs 
     // (such as the Refund Method) to identify this payment. 
     // The pay key is valid for 3 hours; the payment must be approved while the 
     // pay key is valid. 
     responseValues.Add("Pay Key", Response.payKey); 

     // The status of the payment. Possible values are: 
     // CREATED – The payment request was received; funds will be transferred once the payment is approved 
     // COMPLETED – The payment was successful 
     // INCOMPLETE – Some transfers succeeded and some failed for a parallel payment or, for a delayed chained payment, secondary receivers have not been paid 
     // ERROR – The payment failed and all attempted transfers failed or all completed transfers were successfully reversed 
     // REVERSALERROR – One or more transfers failed when attempting to reverse a payment 
     // PROCESSING – The payment is in progress 
     // PENDING – The payment is awaiting processing 
     responseValues.Add("Payment Execution Status", Response.paymentExecStatus); 

     if (Response.defaultFundingPlan != null && Response.defaultFundingPlan.senderFees != null) 
     { 
      // Fees to be paid by the sender 
      responseValues.Add("Sender Fees", Response.defaultFundingPlan.senderFees.amount + Response.defaultFundingPlan.senderFees.code); 
     } 
    } 

    foreach (ErrorData ed in Response.error) 
    { 
     this.ErrorMessage += ed.message + " "; 
    } 
    if (!string.IsNullOrWhiteSpace(this.ErrorMessage)) 
    { 
     new Tracker().sendToGenclikDev("PaypalAdaptiveGateway", this.ErrorMessage); 
    } 

    responseValues.Add("Acknowledgement", Response.responseEnvelope.ack.ToString().Trim().ToUpper()); 

     return redirectUrl; 
} 

Antwort

1

Wir haben exakt das gleiche Problem seit Freitag, den 13. Januar 2017. Es scheint vor allem auf die erste Zahlung Umleitungsanforderung geschehen. Wenn Sie vom Home-Bildschirm von Paypal zurück navigieren, den Zurück-Button des Browsers verwenden und erneut mit einem neuen Token posten, funktioniert es.

Jeder, der eine Lösung kennt, wäre eine große Hilfe!

+0

hier die anwser von paypal: Unsere Ingenieure untersuchen noch das Problem. Ich werde Ihnen ein Update zur Verfügung stellen, sobald eines verfügbar ist. Vielen Dank und einen schönen Tag! – Treping

+0

Haben Sie einen Link zum offenen Problem auf Paypal? Wie können wir verfolgen? Danke – Alexandre