• atlantepinec

    (@atlantepinec)


    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:

    1. Initial Selection: Customer selects credit card payment, activating the PayPal SDK script.
    2. 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.
    3. 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]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Krystian from Syde

    (@inpsydekrystian)

    Hello @atlantepinec

    Thanks for reaching out to us, we’re here to help.

    Initial Selection: Customer selects credit card payment, activating the PayPal SDK script.

    It’s important to note that the PayPal SDK is enqueued on the page load, not specifically when selecting the PayPal/Credit Card gateway. This means that the SDK is ready to be used as soon as the page is loaded, regardless of the payment method initially chosen by the customer.

    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.

    This action might not be necessary and is actually causing the issues you’re experiencing. Removing the PayPal script can break the plugin functionality, especially the card fields, which are essential for credit card payments.

    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.

    This is s a direct result of removing the PayPal SDK script earlier in the process. To resolve this issue, the best approach is to avoid removing the PayPal SDK script from the DOM in the first place.

    In any case, I’m not sure how we can help you with your custom gateway. This is a bit outside of what our support can do.

    Kind regards,
    Krystian

    Thread Starter atlantepinec

    (@atlantepinec)

    Thank you Krystian, really appreciate your reply.

    I need guidance on reinitializing form fields via the SDK. Upon initial page load, I’ve noticed that the required script isn’t immediately present in the DOM. The UI is temporarily blocked by a loading spinner, and it takes a second or two for the script to be added. Initially, I attempted to store the script in a variable and then reinsert it into the DOM later, hoping this would reactivate the form fields. However, this approach hasn’t been successful in reverting the forms to their functional state with the SDK fields. Is there a specific function or method within the SDK that can be used to trigger this reactivation of the form fields? Any assistance or insights on this matter would be greatly appreciated.

    Thank you.

    Plugin Support Krystian from Syde

    (@inpsydekrystian)

    Hello @atlantepinec

    I regret to inform you that this situation falls outside the scope of support we can provide. The specific nature of your request requires a more tailored approach that would involve detailed developer intervention. Given that this is a unique situation requested by only one user, we are unable to allocate resources for a custom solution.

    I understand this may not be the response you were hoping fo, but if you have any other questions or require assistance with different aspects of our services, please feel free to reach out.

    Kind Regards,

    Krystian

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Use paypal to create authorizations alongside credit card charges’ is closed to new replies.