1

Hi i am using paypal (sandbox account) to integrate to my asp.net website.I am able to enter into paypal with price and item name,But i want to get these paramaters in return url so i can save them in database for my records.

I am trying this is on local.(Is this possible to get parameters in return url for local).

On Paypal when i click on "Return to facilitator account's Test Store" then it return me to successpage.aspx.

How i can get parameters value in this return url.

Here code that i have write checkout page :

Protected Sub imgbtn_Click(sender As Object, e As ImageClickEventArgs) Handles imgbtn.Click

Dim qty As Integer = Request.QueryString("qty")
Dim Amount As String = Request.QueryString("price")
Dim ItemDescription As String = Request.QueryString("ItemDescription")
Dim redirectUrl As String = ""

'Mention URL to redirect content to paypal site
redirectUrl += "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" & ConfigurationManager.AppSettings("paypalemail").ToString()

'Product Name
redirectUrl += "&item_name=" + ItemDescription

'Product Amount
redirectUrl += "&amount=" + Amount

'Business contact paypal EmailID
redirectUrl += "&xxxxx-facilitator@gmail.com"

'Quantiy of product, Here statically added quantity 1
redirectUrl += "&quantity=" + qty.ToString()

'If transactioin has been successfully performed, redirect SuccessURL page- this page will be designed by developer
redirectUrl += "&return=" & ConfigurationManager.AppSettings("SuccessURL").ToString()


redirectUrl += "&cancel_return=" & ConfigurationManager.AppSettings("FailedURL").ToString()

Response.Redirect(redirectUrl)

End Sub

webconfig code:

     <appSettings>
      <add key="paypalemail" value="xxxx-facilitator@gmail.com" />
     <add key="SuccessURL" value="http://localhost:53725/Project/SuccessPayment.aspx  " />
     <add key="FailedURL" value="http://localhost:53725/Project/Index.aspx" />


  </appSettings>

I have tried one link of stackoverflow,But i did not get this properly.

http://stackoverflow.com/questions/15322148/paypal-multi-parameters-in-return-cancel-return-urls

I am doing this first time So please suggest me with your valuable answers.

Thanks

shivani
  • 23
  • 5
  • follow below link I hope you can find your answer. [http://stackoverflow.com/questions/24516642/asp-net-c-sharp-get-referer-from-paypal/24516883#24516883][1] [1]: http://stackoverflow.com/questions/24516642/asp-net-c-sharp-get-referer-from-paypal/24516883#24516883 – user3786581 Jul 01 '14 at 18:24

1 Answers1

0

Change the line of code where you set the return url to this:

redirectUrl += "&return=" & ConfigurationManager.AppSettings("SuccessURL").ToString() & _
"&custom=MyCustomValue"

And track any other custom parameters like this. Also, you should url encode the entire return url as it includes a query-string within query-string.

Prahlad Yeri
  • 3,567
  • 4
  • 25
  • 55