PayPal Sandbox working on localhost but not working on live server

DhruvinShah
New Community Member

I've integrated PayPal Rest API in my ASP.NET c# application. Uptil now I was working with localhost for my local enviroment. I was testing through my sandbox account.

 

On my local environment everything works fine. PayPal returns me correct approval URL. Here is my code

var guid = Convert.ToString((new Random()).Next(100000));
var createdPayment = this.CreatePayment(apiContext, baseURI + "guid=" + guid, payment);
var links = createdPayment.links.GetEnumerator();
string paypalRedirectUrl = null;
while (links.MoveNext())
{
         Links lnk = links.Current;
         if (lnk.rel.ToLower().Trim().Equals("approval_url"))
         {
                  paypalRedirectUrl = lnk.href;
         }
}

On my local solution PayPal returns Sandbox link as per below:

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-3JB10334ST833345D#/chec...

which returns me to PayPal page as expected

 

 

But When I upload this application on my live server, this code returns me following url:

http://dev.myDomain.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-5TN94291D37925436

This returns me to my domain not to PayPal Page.

Is it anything wrong with my code or Sandbox solution doesn't work on live server? should I use live account for live server?

 

 

 

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.