Letoncse
Letoncse

Reputation: 722

Paypal sandbox integration with asp.net c#

I am using PayPal sandbox solution.I sent this request bellow way:

   string redirecturl = "";
                redirecturl += "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" + ConfigurationManager.AppSettings["paypalemail"].ToString();
                redirecturl += "&first_name=Liton";
                redirecturl += "&city=Dhaka";
                redirecturl += "&state=Baridhara";
                redirecturl += "&item_name=Recharge";
                redirecturl += "&amount=" + money;
                redirecturl += "&shipping=0";
                redirecturl += "&handling=0";
                redirecturl += "&tax=0";
                redirecturl += "&quantity=1";
                redirecturl += "&currency=USD";
                redirecturl += "&return=" + ConfigurationManager.AppSettings["SuccessURL"].ToString();
                redirecturl += "&cancel_return=" + ConfigurationManager.AppSettings["FailedURL"].ToString();    
                Response.Redirect(redirecturl);

After successfully payment i cannot get Paypal return value. How can i get return value if success or fail?

        tranref = Request.QueryString["tx"].ToString();
        transtat = Request.QueryString["st"].ToString();
        tranamt = Request.QueryString["amt"].ToString();
        trancur = Request.QueryString["cc"].ToString();

I am trying to get value in Success page this way but all value are null.Please help me to catch return value.

Upvotes: 3

Views: 5474

Answers (1)

Gerzie
Gerzie

Reputation: 2330

You would need to use Payment Data Transfer (PDT) to grab and verify the return information for a Payments Standard transaction. There are some samples here: https://github.com/paypal/pdt-code-samples

You may want to set the rm variable with a value of 1 if you're after GET details or 2 if you want POST information. Using PDT the return method will always be a GET.

Upvotes: 1

Related Questions