PayPal integration language

I am wanting to integrate PayPal into a web site. I have code samples for cURL,Ruby,Python,Node.js,PHP,Java and C#. What language snippet would be the easiest to integrate into a Xojo Web app. PHP sorta looks like a simple HTML cut and paste, but I get the feeling it can’t be that simple.

The HTML that they supply for ‘buy now’ buttons is literally just pasted in.
Been working fine for me for many years

This is code for an old app, (numbers etc changed, so this isn’t working code)
It displays some option,s with a buy now button at the bottom

[code]

Mysoft 2012 (UK Prices)
Mysoft Download Only £39.00 GBP Mysoft on USB Stick £49.00 GBP Mysoft on CD £44.00 GBP
[/code]

That’s pure HTML…
May I ask, when people purchase your (items / products) / software, how do you confirm this purchase?
Do you need to visit paypal.com to look at your account every day or do you have some kind of automatic feature that let the customer do all the work and you get all the money with no interaction…?

I intend to sell subscriptions and I’ve been looking at PayPal, similar code like yours, but the “response part” is not really clear for me.
Can you make PayPal “speak” or send a message to your database or your website or your e-mail…?

it must be a SOAP interface like they use with ebay.
not easy but feasible with xojo
dont loose time using built in soap methods in xojo they work only for simple parameters
and everything today that uses a soap method has complex or sequences parameters.
use html(secure)socket.post methods.

Chris, I remember giving you a hand for Stripe and showed you how to use one of their snippets within an HTMLViewer. The very same technique can be used for Paypal with the HTML. If your products have a fixed price, you can create a button, and use the generated code with LoadURL in the HTMLViewer.

For PHP, you may need to put the page on your site for the server to have a chance to execute it.

Alternatively, you can use the email link generated for the button to ShowURL the payment page in the browser.

When a transaction occurs, Paypal can call a URL and post the information to it. That is called Instant Payment Notification, IPN for short. See http://www.paypal.com/ipn/ where several example code samples are displayed. I have used Perl in the past and php today with a slightly modified version of the example.

Since IPN requires HTTP 1.1, there is no simple way to use a Xojo Web Edition handleURL to do so, unfortunately. I had thought about simply relaying the information received by the PHP to the WE, but never found the time to do it.

There is a member who pretends to have implemented 1.1, but the last time I heard of him was last September. He was supposed to fix the demo of a non working Stripe class he had sold to Chris, and apparently vanished since. This looks as an AYOR situation that does not seem credible for any serious business.

Paypal send you an email with the product details when a payment is made.
You then post something or email a download link or serial number.

If you enlist the aid of someone like ‘E-Junkie’ then they can handle the validation of the payment with Paypal, send software links, issue serial numbers and basically take away all the work. For about $12 a month.

That was working great for me until the EU VAT changes broke the whole model from the UK, and now I have had to share the margin with Faststpring, where the end user experience for the customer remains the same, but the ‘vendor’ is FastSpring and Fastspring is my B2B customer

The PayPal developer site actually offers several code examples that are good to go. You paste in your merchant ID and change a few of the values to check for purchasing your item and the scripts are good to go.

As Michel said, the only way to integrate it with a Xojo WebApp would be to use something separate from the webapp and relay it back in due to Xojo’s HTTP1.0 limitation.

I also use IPN with a PHP script. Works perfect. If you need this, let me know.
It handles payments, refunds, saves sales to excel sheet, send mails to the customer, mails to you, …

Thanks for all of your input and suggestions. What I should have explained when initiating this thread was that I have about a hundred items listed on my web site. Many of these have selectable options, so the plan was to have the web app generate the ‘required code’ when a customer has finished shopping and decides to check out. Generating button code for each item on sale just won’t do the trick. I have given up on stripe for the time being because implementing their APIs is pretty hard and I figure that if some of the other pretty skilled programmers on this forum can’t work things out. what chance have I got.

I studied the possibility to add Stripe as a payment option for my customers, but frankly their API is a nightmare, so I simply gave up. The day the really want to challenge Paypal, they will make it easier on customers instead of requiring stupid steps to implement their system. No wonder why Paypal is the first worldwide.

Back to Paypal, they do not advertise it, but there is a way to charge any amount and any product by using URL parameters, called “Payment standard” . With fonts I have hundreds of references, and a part of my sales are done that way :

$url = "https://www.paypal.com/xclick/business=myaddress@mybusiness.com&item_name=$name&item_number=$reference&amount=$value&no_shipping=2&no_note=1&currency_code=USD&custom=$whatever" business= the email address you registered with Paypal item_name= Product description item_number= SKU amount= self explanatory no_shipping=2 prompt for an address no_note=1 if zero, add a box where customer can enter special instructions currency_code=USD custom= Anything you want

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

I thought Xojo WE was using HTTP1.1 since the last release?

You are right, there is mention in the release notes :
35161 Web: HTTP Responses now include a standard HTTP/1.1 response messages.

But I am not too sure that will be enough. When Paypal started requiring 1.1, it became necessary to modify the PHP to send using that otherwise it did not work.

Here is the php code I use in my IPN listener :

// post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.1\\r\ "; $header .= "Content-Length: " . strlen($req) . "\\r\ "; $header .= "Content-Type: application/x-www-form-urlencoded\\r\ "; $header .= "Host: www.paypal.com\\r\ "; $header .= "Connection: close\\r\ \\r\ "; $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);

I do not have time to create a web service in Xojo, but it seems pretty straightforward

[quote=154329:@Michel Bujardet]You are right, there is mention in the release notes :
35161 Web: HTTP Responses now include a standard HTTP/1.1 response messages.[/quote]
That particular feedback case was simply for allowing the text that is returned with a response to properly reflect the status number, e.g. when you set the status to 404 it should return something like “Not Found” rather than “OK” as it always did previously.

I remember a thread where Geg explained the header was sent by Xojo so it was not possible to fake it. But since now it seems to send the pope,r status, it is possible that it may suffice to be able to create a listener in Xojo. As I wrote, i do not have time at present, but I will probably come back to it in the future to see if it is doable.

If one can use plain HTML to perform a payment checkout, why does it offer 7 other languages to do the job.Why doesn’t it just suggest we all use HTML for Paypal/web app integration.

because people go back to them and say

‘I want to use cURL,Ruby,Python,Node.js,PHP,Java and C# and if you don’t respect my life choices …’

:slight_smile:

[quote=154542:@Jeff Tullin]because people go back to them and say

[/quote] "I guess asking them to have Xojo included would be out of the question.

You never know until you ask. But by the same token, why don’t they have VB .NET ?

But, are we talking about IPN listener or Payment standard ? IPN listener could not be written in Xojo, since WE did not support the required HTTP 1.1.

I thought the REST api covered responses from the Paypal server. In short, I really only need code that would take the buyer to the Paypal site with the product code, options and total amount. Conformation of a payment would be received via the normal process of IPN email. HTML looks promising because Xojo has a control that allows HTML and possibly PHP to be executed within the Web app process.

I don’t understand. That is exactly what the Payment Standard link I posted above yesterday does. All you got to do is insert the proper variables. And it can be used within a web app just as well as a desktop one. Usually a few lines. Have you even read it ?

:confused: