Oct 6, 2011, 6:20 AM
11 Posts
topic has been resolvedResolved

Paypal anyone?

  • Category: APIs
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: Paypal?
  • Replies: 7
Has anyone got any experience of connecting up XPages to Paypal, please?
 
I've come across Tim Tripcony's "SnTT: Integrating PayPal with Domino" back from 2007 which gives some Java code to achieve the integration, but I'm struggling to marry that up or apply it's principles in an XPage environment.
 
Any thoughts would be gratefully received.
Thanks and regards. Jerry.
Oct 6, 2011, 9:42 AM
298 Posts
question
Do you use Paypal or PayPal Payflow (credit card processing)? We use Payflow Link with Domino now, was thinking of moving our shopping experience to XPages and was wondering about integration too. Howard
Oct 6, 2011, 11:59 AM
11 Posts
Re: Paypal anyone?
Good question Howard. I'm trying to find that out from the Client. I'll try and remember to let you know if I get anywhere with it in XPages.
Oct 6, 2011, 1:29 PM
57 Posts
Re: Paypal anyone?
this is what i have to integrate with moneybooker, it should not be too much different from paypal, read paypal/moneybooker API, all you need to do is to send some request data to moneybooker then you get response, you render response in a iframe then put it on xpages
 
String RequestStr = "https://www.moneybookers.com/app/payment.pl";
        URL url;
        try {
            url = new URL(RequestStr);

            URLConnection con = url.openConnection();
            HttpsURLConnection connection = (HttpsURLConnection) con;
            connection.setRequestMethod("POST");
            connection.setDoOutput(true);
            connection.setDoInput(true);
            DataOutputStream out = new DataOutputStream(connection
                    .getOutputStream());
            String content = "pay_to_email=weihang@wei.com&language=EN&amount=1&currency=EUR&detail1_description=orderID&detail1_text=ID";
            out.writeBytes(content);
            out.flush();
            out.close();
            // read response
            InputStream is = connection.getInputStream();
            String responseStr = convertStreamToString(connection
                    .getInputStream());
            responseStr = "<iframe id='iframe2' name='iframe2' width='99%' height='600' src='https://www.moneybookers.com/app/payment.pl?pay_to_email=weihang@wei.cn&language=EN&amount=1&currency=EUR&detail1_description=orderID&detail1_text=ID' frameborder='1' scrolling='yes'>"
                    + responseStr;
            responseStr += "</iframe>";
            UIComponent c = JSFUtil.findComponent("moneyBooker");
            com.ibm.xsp.component.xp.XspOutputText computedField = (com.ibm.xsp.component.xp.XspOutputText) c;
            computedField.setValue(responseStr);
Oct 7, 2011, 9:39 AM
11 Posts
Re: Paypal anyone?
Thank you weihang chen, but how do you call that from the Submit button on the XPage, please?
Oct 7, 2011, 7:54 PM
57 Posts
Re: Paypal anyone?
the last few rows actually put the response from moneybooker into a computed field in xpages...................the whole piece of code can be wrapped into a function being called by submit button, as long as a computed field configured with that ID is placed in xpages, being rendered as HTML, you should have no problem seeing a payment interface the major payment gateway like paypal or moneybooker.................
 
All major OScommerce platforms have these kind of plugin, search on google, you will find a lot of examples. 
Oct 13, 2011, 9:59 AM
11 Posts
Re: Paypal anyone?
Here's how I cracked Paypal ...
 
Once I had discovered that the client's Paypal Account was a "Website Payments Standard" one then I could figure out how to send requests to Paypal.
(I found this out by logging into the Client's Paypal account and clicking on "My Business Setup")
 
You setup Buttons within your account, that you copy and paste the HTML code for and place them on your XPage source.
(Click on Profile, My Selling Preferences, Paypal Buttons - update)
 
Adding the HTML code to the XPage source didn't do anything when you clicked on the Buy Now icon ... until I found that there's an <xp:form> tag that is used in conjunction with an HTML <Form> tag ...
There doesn't seem to be any relation between the XPage and HTML Form tags, just that the XPage needs an xp:form one in order to recognise the HTML one.
 
Really making progress now! I moved the HTML Form Tag to a "confirmation" XPage that was called from the 1st XPage's Submit button, so that the data source can be saved in the first XPage, and then the Submit of the 2nd page can be sent to Paypal.
 
Hope that helps someone in the future ... and me remember it in a few month's time too! Cheers. Jerry.
 
 
 
Jan 2, 2014, 12:09 PM
2 Posts
Clarification?

Hi JP, I realize this was a while ago, but could you please elaborate on your comment about the xp:form tag and the HTML Form tag?

I am struggling with Domino Paypal integration, although I have done it before in C# without much trouble. An example of what you mean would be really good!