Use paypal to create authorizations alongside credit card charges
-
I’m working with a custom WooCommerce payment gateway that allows for a unique flow: customers can authorize a payment via credit card, but then opt to pay by check/wire. If they choose the check/wire option, we temporarily hold the card authorization and manually mark the order as paid upon receiving the check. If the check isn’t received, we have the option to capture the payment on the card.
Our custom gateway works well, except for an issue when switching payment methods in the checkout process. Here’s the scenario:
- Initial Selection: Customer selects credit card payment, activating the PayPal SDK script.
- Switch to Check/Wire: Customer changes their mind and selects check/wire payment. At this point, our custom script removes the PayPal SDK script from the DOM.
- Switch Back to Credit Card: If the customer switches back to credit card payment, the form breaks. We attempted to fix this by storing the PayPal SDK script in a variable and then prepending it back to the DOM when the credit card is selected again. However, this isn’t working.
I believe the issue lies in the credit card fields loading immediately and not being triggered to update since the original PayPal SDK script isn’t present in the DOM at the right moment.
Question: How can I effectively reinitialize the PayPal SDK when the credit card option is reselected? Is there a JavaScript/jQuery method to trigger the reinitialization, or is there a better approach to handle this scenario?
Any insights or suggestions on how to resolve this would be greatly appreciated.
The page I need help with: [log in to see the link]
- The topic ‘Use paypal to create authorizations alongside credit card charges’ is closed to new replies.