Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Popup custom payment module is posting and redirecting

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 06-29-2016, 09:11 PM
 
akinyeleolubodun akinyeleolubodun is offline
 

Newbie
  
Join Date: Jun 2016
Posts: 4
 

Smile Popup custom payment module is posting and redirecting

Hi,

I am developing a custom payment plugin that is meant to work like Stripe.

I have in my payment.js, the below code

Code:
core.bind( 'checkout.main.initialize', function() { core.bind( 'checkout.common.ready', function(event, state) { $( "#kpay-pay_trigger" ).click(); state.state = false; } ); } );

This shows the popup fine but I have a challenge with it posting and redirecting. It doesn't make the popup state well enough for the user to perform payment action.

Please I need an urgent help on this.

Regards.
__________________
5.2.8
Reply With Quote
  #2  
Old 06-29-2016, 10:29 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Popup custom payment module is posting and redirecting

Hello,

SimplifyCommerce and PayPal are two other modules that behave like Stripe module and use a similar way to hack into the flow. So, you may check the source code of these modules too.

Please can you explain the issue with more details? As far as I see you use a different JS code than Stripe module, so it may be the cause.
What is the desired flow, and what in the flow goes wrong at the moment?
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 06-30-2016, 12:26 AM
 
akinyeleolubodun akinyeleolubodun is offline
 

Newbie
  
Join Date: Jun 2016
Posts: 4
 

Default Re: Popup custom payment module is posting and redirecting

Thanks for your reply qualiteam. I have gone through the source codes and code not really make headway.

Here is the flow...

1. I add the payment plugin js to the checkout page (Working)
2. Build some data on the template (Working, find below sample code)
Code:
<div id="kpay-pay-component" style="display: none;"></div> <script src="{getScriptInstance()}"></script> <script> new KongaPay({ merchantId: "{getMerchantId()}", merchantName: "{getMerchantName()}", callBack: "{getCallbackUrl()}", amount: "{getItemsTotal()}", transactionReference: "{getTransactionReference()}", buttonSize: 300, description : "{getDescription()}" }); </script>

3. When the payment gateway loads the JS, it displays a button to be clicked in
Quote:
<div id="kpay-pay-component" style="display: none;"></div>

4. I hide the element so that when the user clicks the "Place Order" button on checkout, it clicks the button displayed by the payment gateway dynamically. (Worked well)

5. When the payment gateway popup comes up, it doesn't stay...other process happens and the page is being redirected.

Quote:
As far as I see you use a different JS code than Stripe module, so it may be the cause.

Yes it is not Stripe's code, I strip it down to the barest minimum because it contains code that are not conforming to my payment gateway flow.

I suppose the
Code:
state.state = false;
in the JS would stop the page from reloading but I was wrong. Maybe I am not initiating the right bind event.
__________________
5.2.8
Reply With Quote
  #4  
Old 07-01-2016, 01:28 AM
 
akinyeleolubodun akinyeleolubodun is offline
 

Newbie
  
Join Date: Jun 2016
Posts: 4
 

Unhappy Re: Popup custom payment module is posting and redirecting

Please help ^^^^
__________________
5.2.8
Reply With Quote
  #5  
Old 07-05-2016, 01:19 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Popup custom payment module is posting and redirecting

state.state determines whether the order can be placed, or not. If you set it to false the order will never be placed.
Stripe module sets this property to false if the module is enabled, but the token from Stripe is empty.

The recommended way to initialize the JS part of your integration is hooking to the checkout.paymentTpl.postprocess event (like Stripe does).

Where does the redirect happens to? Does it submit to the payment gateway's server? If so, you should either put that into an IFRAME, or use the standard flow for web-redirect based integrations (without any background checks).
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:42 AM.

   

 
X-Cart forums © 2001-2020