Re: Paypal Integration / JNSI
I'm using gwtp and smartgwt UI components. Can anyone help me with some code to link the submit button to the paypal script? How do I get the id of the submit button? private ButtonItem btnPay = new ButtonItem(Pay); I plan to create a button such as the above which will, on click, use the action handler on the server to create the payment. Then hopefully call the JSNI below to open an iFrame / mini window and initiate the user's approval flow private native void paypalLight() /*-{ var dgFlow = new $wnd.PAYPAL.apps.DGFlow({ trigger : 'btnPay' }); }-*/; My question is: How do I link the btnPay button's dom id to the trigger in JSNI code? TIA On Tuesday, 29 May 2012 06:13:46 UTC+10, Sydney wrote: When the user cancels or finishes the purchase, Paypal redirects the user to a page within the iframe or popup window. My cancel URL looks like this http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=true. I am using GWTP so the following code should give you an idea on how it works: @Override public void prepareFromRequest(PlaceRequest placeRequest) { super.prepareFromRequest(placeRequest); String cancel = placeRequest.getParameter(cancel, ); if (true.equals(cancel)) { paypalClose(); } } public static native void paypalClose() /*-{ if (top top.opener top.opener.top) { top.opener.top.dgFlow.closeFlow(); top.close(); } else if (top) { top.dgFlow.closeFlow(); top.close(); } }-*/; top.close() will close the paypal flow (iframe or popup window). On Monday, May 28, 2012 5:06:23 PM UTC+2, Mayumi wrote: Thank you so much for the reply! So you're calling JSNI above from the return/cancel page correct? If so are you doing something like window.parent. paypalClose() from inside the IFRAME that paypal insert the return/cancel pages from? Thanks! On Monday, 28 May 2012 03:42:58 UTC-5, Sydney wrote: public static native void paypalClose() /*-{ if (top top.opener top.opener.top) { top.opener.top.dgFlow.closeFlow(); top.close(); } else if (top) { top.dgFlow.closeFlow(); top.close(); } }-*/; On Sunday, May 27, 2012 8:21:25 PM UTC+2, Mayumi wrote: How did you end up fixing this? On Saturday, 12 May 2012 08:41:58 UTC-5, Sydney wrote: I use the Paypal Adaptive API. So far I managed to display the paypal page using a lightbox. But I have a problem when trying to close the lightbox. I failed in Step 4 *3. Include the PayPal JavaScript functions from dg.js.* * * *script src=https://www.paypalobjects.com/js/external/dg.js;* */script* * * *4. Create an embedded flow object and associate it with your payment form or button.* * * *script* *var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });* */script* * * *After Completing This Task: * * * *On the pages you identify as the return and cancel URLs in the Pay API operation, you must* *include the PayPal JavaScript functions from dg.js and close the PayPal window, as in the* *following example:* * * *dgFlow = top.dgFlow || top.opener.top.dgFlow;* *dgFlow.closeFlow();* *top.close();* *What I did:* For step 4, I call the following JNSI method: private native void paypalLight() /*-{ var dgFlow = new $wnd.PAYPAL.apps.DGFlow({ trigger : 'submitBtn' }); }-*/; The paypal page is displayed in the lightbox, than I click the cancel button. My cancelURL is http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=trueand in this page I process the cancel parameter by calling the following JNSI: public static native void paypalClose() /*-{ dgFlow = $wnd.top.dgFlow || $wnd.top.opener.top.dgFlow; dgFlow.closeFlow(); $wnd.top.close(); }-*/; When I cancel the transaction, the cancelUrl gets called, and the paypalClose method is called. I get the error: (TypeError): $wnd.top.opener is null. Any ideas? Thanks -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Paypal Integration / JNSI
public static native void paypalClose() /*-{ if (top top.opener top.opener.top) { top.opener.top.dgFlow.closeFlow(); top.close(); } else if (top) { top.dgFlow.closeFlow(); top.close(); } }-*/; On Sunday, May 27, 2012 8:21:25 PM UTC+2, Mayumi wrote: How did you end up fixing this? On Saturday, 12 May 2012 08:41:58 UTC-5, Sydney wrote: I use the Paypal Adaptive API. So far I managed to display the paypal page using a lightbox. But I have a problem when trying to close the lightbox. I failed in Step 4 *3. Include the PayPal JavaScript functions from dg.js.* * * *script src=https://www.paypalobjects.com/js/external/dg.js;* */script* * * *4. Create an embedded flow object and associate it with your payment form or button.* * * *script* *var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });* */script* * * *After Completing This Task: * * * *On the pages you identify as the return and cancel URLs in the Pay API operation, you must* *include the PayPal JavaScript functions from dg.js and close the PayPal window, as in the* *following example:* * * *dgFlow = top.dgFlow || top.opener.top.dgFlow;* *dgFlow.closeFlow();* *top.close();* *What I did:* For step 4, I call the following JNSI method: private native void paypalLight() /*-{ var dgFlow = new $wnd.PAYPAL.apps.DGFlow({ trigger : 'submitBtn' }); }-*/; The paypal page is displayed in the lightbox, than I click the cancel button. My cancelURL is http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=trueand in this page I process the cancel parameter by calling the following JNSI: public static native void paypalClose() /*-{ dgFlow = $wnd.top.dgFlow || $wnd.top.opener.top.dgFlow; dgFlow.closeFlow(); $wnd.top.close(); }-*/; When I cancel the transaction, the cancelUrl gets called, and the paypalClose method is called. I get the error: (TypeError): $wnd.top.opener is null. Any ideas? Thanks -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/BxOaaYXbf08J. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Paypal Integration / JNSI
Thank you so much for the reply! So you're calling JSNI above from the return/cancel page correct? If so are you doing something like window.parent. paypalClose() from inside the IFRAME that paypal insert the return/cancel pages from? Thanks! On Monday, 28 May 2012 03:42:58 UTC-5, Sydney wrote: public static native void paypalClose() /*-{ if (top top.opener top.opener.top) { top.opener.top.dgFlow.closeFlow(); top.close(); } else if (top) { top.dgFlow.closeFlow(); top.close(); } }-*/; On Sunday, May 27, 2012 8:21:25 PM UTC+2, Mayumi wrote: How did you end up fixing this? On Saturday, 12 May 2012 08:41:58 UTC-5, Sydney wrote: I use the Paypal Adaptive API. So far I managed to display the paypal page using a lightbox. But I have a problem when trying to close the lightbox. I failed in Step 4 *3. Include the PayPal JavaScript functions from dg.js.* * * *script src=https://www.paypalobjects.com/js/external/dg.js;* */script* * * *4. Create an embedded flow object and associate it with your payment form or button.* * * *script* *var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });* */script* * * *After Completing This Task: * * * *On the pages you identify as the return and cancel URLs in the Pay API operation, you must* *include the PayPal JavaScript functions from dg.js and close the PayPal window, as in the* *following example:* * * *dgFlow = top.dgFlow || top.opener.top.dgFlow;* *dgFlow.closeFlow();* *top.close();* *What I did:* For step 4, I call the following JNSI method: private native void paypalLight() /*-{ var dgFlow = new $wnd.PAYPAL.apps.DGFlow({ trigger : 'submitBtn' }); }-*/; The paypal page is displayed in the lightbox, than I click the cancel button. My cancelURL is http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=trueand in this page I process the cancel parameter by calling the following JNSI: public static native void paypalClose() /*-{ dgFlow = $wnd.top.dgFlow || $wnd.top.opener.top.dgFlow; dgFlow.closeFlow(); $wnd.top.close(); }-*/; When I cancel the transaction, the cancelUrl gets called, and the paypalClose method is called. I get the error: (TypeError): $wnd.top.opener is null. Any ideas? Thanks -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/VzdiU4boHuMJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Paypal Integration / JNSI
When the user cancels or finishes the purchase, Paypal redirects the user to a page within the iframe or popup window. My cancel URL looks like this http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=true. I am using GWTP so the following code should give you an idea on how it works: @Override public void prepareFromRequest(PlaceRequest placeRequest) { super.prepareFromRequest(placeRequest); String cancel = placeRequest.getParameter(cancel, ); if (true.equals(cancel)) { paypalClose(); } } public static native void paypalClose() /*-{ if (top top.opener top.opener.top) { top.opener.top.dgFlow.closeFlow(); top.close(); } else if (top) { top.dgFlow.closeFlow(); top.close(); } }-*/; top.close() will close the paypal flow (iframe or popup window). On Monday, May 28, 2012 5:06:23 PM UTC+2, Mayumi wrote: Thank you so much for the reply! So you're calling JSNI above from the return/cancel page correct? If so are you doing something like window.parent. paypalClose() from inside the IFRAME that paypal insert the return/cancel pages from? Thanks! On Monday, 28 May 2012 03:42:58 UTC-5, Sydney wrote: public static native void paypalClose() /*-{ if (top top.opener top.opener.top) { top.opener.top.dgFlow.closeFlow(); top.close(); } else if (top) { top.dgFlow.closeFlow(); top.close(); } }-*/; On Sunday, May 27, 2012 8:21:25 PM UTC+2, Mayumi wrote: How did you end up fixing this? On Saturday, 12 May 2012 08:41:58 UTC-5, Sydney wrote: I use the Paypal Adaptive API. So far I managed to display the paypal page using a lightbox. But I have a problem when trying to close the lightbox. I failed in Step 4 *3. Include the PayPal JavaScript functions from dg.js.* * * *script src=https://www.paypalobjects.com/js/external/dg.js;* */script* * * *4. Create an embedded flow object and associate it with your payment form or button.* * * *script* *var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });* */script* * * *After Completing This Task: * * * *On the pages you identify as the return and cancel URLs in the Pay API operation, you must* *include the PayPal JavaScript functions from dg.js and close the PayPal window, as in the* *following example:* * * *dgFlow = top.dgFlow || top.opener.top.dgFlow;* *dgFlow.closeFlow();* *top.close();* *What I did:* For step 4, I call the following JNSI method: private native void paypalLight() /*-{ var dgFlow = new $wnd.PAYPAL.apps.DGFlow({ trigger : 'submitBtn' }); }-*/; The paypal page is displayed in the lightbox, than I click the cancel button. My cancelURL is http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=trueand in this page I process the cancel parameter by calling the following JNSI: public static native void paypalClose() /*-{ dgFlow = $wnd.top.dgFlow || $wnd.top.opener.top.dgFlow; dgFlow.closeFlow(); $wnd.top.close(); }-*/; When I cancel the transaction, the cancelUrl gets called, and the paypalClose method is called. I get the error: (TypeError): $wnd.top.opener is null. Any ideas? Thanks -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/PA18WxkN3MoJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Paypal Integration / JNSI
Thanks :) On Saturday, 12 May 2012 08:41:58 UTC-5, Sydney wrote: I use the Paypal Adaptive API. So far I managed to display the paypal page using a lightbox. But I have a problem when trying to close the lightbox. I failed in Step 4 *3. Include the PayPal JavaScript functions from dg.js.* * * *script src=https://www.paypalobjects.com/js/external/dg.js;* */script* * * *4. Create an embedded flow object and associate it with your payment form or button.* * * *script* *var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });* */script* * * *After Completing This Task: * * * *On the pages you identify as the return and cancel URLs in the Pay API operation, you must* *include the PayPal JavaScript functions from dg.js and close the PayPal window, as in the* *following example:* * * *dgFlow = top.dgFlow || top.opener.top.dgFlow;* *dgFlow.closeFlow();* *top.close();* *What I did:* For step 4, I call the following JNSI method: private native void paypalLight() /*-{ var dgFlow = new $wnd.PAYPAL.apps.DGFlow({ trigger : 'submitBtn' }); }-*/; The paypal page is displayed in the lightbox, than I click the cancel button. My cancelURL is http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=trueand in this page I process the cancel parameter by calling the following JNSI: public static native void paypalClose() /*-{ dgFlow = $wnd.top.dgFlow || $wnd.top.opener.top.dgFlow; dgFlow.closeFlow(); $wnd.top.close(); }-*/; When I cancel the transaction, the cancelUrl gets called, and the paypalClose method is called. I get the error: (TypeError): $wnd.top.opener is null. Any ideas? Thanks -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/d6HspEhL7_cJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Paypal Integration / JNSI
How did you end up fixing this? On Saturday, 12 May 2012 08:41:58 UTC-5, Sydney wrote: I use the Paypal Adaptive API. So far I managed to display the paypal page using a lightbox. But I have a problem when trying to close the lightbox. I failed in Step 4 *3. Include the PayPal JavaScript functions from dg.js.* * * *script src=https://www.paypalobjects.com/js/external/dg.js;* */script* * * *4. Create an embedded flow object and associate it with your payment form or button.* * * *script* *var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });* */script* * * *After Completing This Task: * * * *On the pages you identify as the return and cancel URLs in the Pay API operation, you must* *include the PayPal JavaScript functions from dg.js and close the PayPal window, as in the* *following example:* * * *dgFlow = top.dgFlow || top.opener.top.dgFlow;* *dgFlow.closeFlow();* *top.close();* *What I did:* For step 4, I call the following JNSI method: private native void paypalLight() /*-{ var dgFlow = new $wnd.PAYPAL.apps.DGFlow({ trigger : 'submitBtn' }); }-*/; The paypal page is displayed in the lightbox, than I click the cancel button. My cancelURL is http://127.0.0.1:/xxx.html?gwt.codesvr=127.0.0.1:9997#!homePage;cancel=trueand in this page I process the cancel parameter by calling the following JNSI: public static native void paypalClose() /*-{ dgFlow = $wnd.top.dgFlow || $wnd.top.opener.top.dgFlow; dgFlow.closeFlow(); $wnd.top.close(); }-*/; When I cancel the transaction, the cancelUrl gets called, and the paypalClose method is called. I get the error: (TypeError): $wnd.top.opener is null. Any ideas? Thanks -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/4hYeb7drNPgJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.