Gavy Hundal
Gavy Hundal

Reputation: 11

Paypal Api is not redirecting to Express Checkout for the first time payment second time its working fine

My code is written in the C# and I am using Paypal API. for the first time I am making payment from customer then it is redirecting to old paypal page having link

https://www.sandbox.paypal.com/in/cgi-bin/webscr?cmd=_flow&SESSION=gVpVeQy6t1RsmlfDy408oT6n3EL6CXLn3bNYG11jzbks50fwd_qYHvqGcdS&dispatch=50a222a57771920b6a3d7b606239e4d529b525e0b7e69bf0224adecfb0124e9b61f737ba21b0819862118003bc2f4b4f47f01ef0a11094f0

Check this screenshot I am debugging the code and receiving the express checkout address "paypal /cgi-bin/webscr?cmd=_express-checkout&token=EC-4M157930054026038" But its redirecting to old paypal page although its working fine when i make payment secont time with same account. But for the first time with new user its getting redirected to old payment page

Here is my paypal code

if (string.IsNullOrEmpty(token1))
{
    // Need to be corrected.
    DateTime date = DateTime.Now;
    Agreement agreement = this.oService.CreateBillingAgreement(apiContext1, Plans1, UserID, date, systemdate).Create(apiContext1);
    List<Links>.Enumerator enumerator = agreement.links.GetEnumerator();
    while (enumerator.MoveNext())
    {
        Links current = enumerator.Current;
        if (current.rel.ToLower().Trim().Equals("approval_url"))
            url1 = current.href;

    }
    this.Session.Add(name1, (object)agreement.token);
    //this.Session.Add(name1, "EC-3LA67769U69944606");
    ////token1 = "EC-3LA67769U69944606";
    this.Session["PlanId"] = (object)agreement.plan.id;
    return (ActionResult)this.Redirect(url1);
}

Upvotes: 1

Views: 152

Answers (1)

dhanrajm
dhanrajm

Reputation: 11

This is the expected behavior as per paypal. Refer to this ticket : https://www.paypal-techsupport.com/app/account/questions/detail/i_id/1327025 I hope this is the same problem you are facing.

Upvotes: 1

Related Questions