Returning from PayPal

I am trying to return to a specific page on a web app after I return from PayPal.

Is a hashtag the best way to accomplish this?

If so, I am having a bit of a problem getting a hashtag set up in the program. All my attempts keep getting the error “This item does not exist.” For my purposes, the language reference is a little sparse on information and examples. The example program did not help for my situation.

Would someone be so kind as to post a few lines of code, showing how I would set the hashtag up before leaving my app for PayPal?

Regards, and thanks in advance.

The buy it now button setup in Paypal has a ‘return page’ attribute already.
Are you totally passing control to Paypal or calling their APIs?

https://www.paypal.com/uk/cgi-bin/webscr?cmd=p/mer/express_return_summary-outside

[quote=211200:@Stuart Travis]I am trying to return to a specific page on a web app after I return from PayPal.

Is a hashtag the best way to accomplish this?

If so, I am having a bit of a problem getting a hashtag set up in the program. All my attempts keep getting the error “This item does not exist.” For my purposes, the language reference is a little sparse on information and examples. The example program did not help for my situation.

Would someone be so kind as to post a few lines of code, showing how I would set the hashtag up before leaving my app for PayPal?

Regards, and thanks in advance.[/quote]

When Paypal returns from a transaction, it returns a URL encoded series of arguments, representing the variables of the transaction. It does not return a HashTag.

See Session.URLParameter. http://documentation.xojo.com/index.php/WebSession.URLParameter the example there will give you all the variables and their value : name, sku, price, etc.

Jeff:

I am totally passing to PayPal.

Michel:

My web app has several pages. When I return to my app from PayPal, I would like to go to a specific page, assuming the customer was able to successfully pay. Information that was saved before they were taken to PayPal would be loaded onto that page.

Currently, having PayPal return my URL say, www.example.com, would take me to the ‘start’ page of my app.

The return page in Paypal does direct to a specific page, not just a website.
I use it to return to a page I call http://mysite.com/Allok.htm which says ‘thanks for the cash’

Does a ‘page’ of your app work in the same way as a ‘normal’ html page?
(I dont use the web Xojo so Im unclear about whether it exposes ‘pages’ in the way that a ‘loose’ web site made of html would…)

[quote=211221:@Stuart Travis]Michel:

My web app has several pages. When I return to my app from PayPal, I would like to go to a specific page, assuming the customer was able to successfully pay. Information that was saved before they were taken to PayPal would be loaded onto that page.

Currently, having PayPal return my URL say, www.example.com, would take me to the ‘start’ page of my app.[/quote]

You can set the return page address in your Paypal account profile, under Web Accept settings.

I would indeed try to use a Hashtag by setting that return page that way :

http://myapp.com#paypalreturn or http://myapp.com:80#paypalreturn

Hopefully Paypal won’t discard the Hashtag upon return.

When Paypal hits the app, the Hashtag will trigger App.HashtagChanged and there you display the appropriate page in your app.

If for some reason Paypal discarded the Hashtag (I doubt it), you can test the number of URL parameters and look for the “sku” param, which is typical of Paypal.

Hi:

When I just try to return to my website, paypal returns me to xojo’s home page.

[quote=216199:@Stuart Travis]Hi:

When I just try to return to my website, paypal returns me to xojo’s home page.[/quote]

Have you set up the return page URL in the Web Accept section of your profile ?

Michel:

Yes, I have set up the “Cancel” to my website “xxxx.com

[quote=216209:@Stuart Travis]Michel:

Yes, I have set up the “Cancel” to my website “xxxx.com”[/quote]

Sigh…

In Profile,

Hosted payment settings
Website payments preferences

Set Return URL to your site.

Yup… sorry Michel… I myself forget how exasperating I can be… The problem was I had https rather than http. That problem fixed… Now, I am working on getting the hashtag to work.

I gave up on PayPal for software purchases and went to Stripe.com. It has a straight forward API that returns the result immediately rather than the call back nonsense…

My experience has just been the opposite. I have used Paypal IPN to this day with full satisfaction. I use a php script derived from the script their provide on their Github. It sends the user all download instructions, keeps a log of sales, and it is reliable as clockworks. I use another script that takes the user to download his purchase upon return from payment. No need for a special API, for a certificate and other complicated things. I use payment standard or buttons, and the user simply transacts on their secure site.

My job is to sell software. Not develop backorder processing.

I tried Stripe simple transaction, but their token post processing is a hassle I did not feel like dealing with. Or their API for that matter.

Michel:

How and where do I set the hashtag before I leave my app? Also, my app is written entirely in xojo.

[quote=216774:@Stuart Travis]Michel:

How and where do I set the hashtag before I leave my app? Also, my app is written entirely in xojo.[/quote]

You set the Return URL in your Paypal Profile Instant Payment Notification preferences with the HashTag.

For instance :

http://mySite.com/cgi-bin/myApp.cgi#pageReturn http://mySite.com:80#pageReturn

Paypal will point to that and add all the fields of the transaction. So what you do is use the HashTagChanged event and check the value of the HashTag. If it is pageReturn, then you show the return page. And you will have all the fields of the transaction into Session.Header(“FieldName”) where “FieldName” stands for the name of each Paypal variable. So you can get the user name, email address, dollar amount, and so on.

See https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

Michel:

I am having no luck setting up the hashtag.

On the page I would like to return to I have:

dim webpage as websession
webpage.hashtag = “http://myapp.com/test-Dev#PayPalReturn

It deploys fine, but crashes when I run that page.

I have used:

http://myapp.com/test-Dev#PayPalReturn

as my return URL at PayPal.

Stuart,

When PayPal sends the customer back to http://myapp.com/test-Dev#PayPalReturn, you should catch it in the Session.HashTagChanged event.

There you can use an if or switch statement to determine which page to show.

Sub HashTagChanged() if me.HashTag = "PayPalReturn" then returnPage.Show end if End Sub

You might want to set some properties on the returnPage before showing it based on what was returned in the params by PayPal.

Is there a manual or something I don’t know about?

I created the sub under my session per Ian’s suggestion. I put in a couple of message boxes just to check if the sub was being hit. It is not. I return from PayPal and it starts at the beginning of my app.

Some questions: How does the program know if the hashtag was changed? Where do I set it in the first place? There is all this wonderful information that is supposed to be sent back from PayPal. How do you access it?

I have been through Xojo’s examples, the online help, and the forum. Where is everybody getting their knowledge that I seem to lack?

Thanks.

Hi Stuart,

When PayPal sends your customer back to your site, it’s going to be a brand new session. So, BEFORE sending your customer off to PayPal you need to save something to your server (database), or to a cookie that you can send to PayPal as part of the original request that they’ll send back to your site on return. That way you know who it was that went off to PayPal and then came back to your site via the return url.

The User Guides and Language Reference are by far the best ways to learn about these kinds of things, along with looking at all the great Examples that come with Xojo. The Xojo IDE’s Help menu has links to all the documentation, and the examples can be accessed from the File > New Project … menu option, where you’ll find a neat “HashTagExample” project in the Web section.