question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't submit Paypal outside of payment form

See original GitHub issue

Hi! What’s the reason of changes made by this PR 754 You broke our logic by that changes. In our website we’re using one submit button for all payment methods and now we can’t use it or should look for dirty “workarounds”. According to your documentation - there is possibility to disable submit buttons for each method by putting showPayButton: false during adyen-web initialisation and then use just one submit button wherever you wish on page and programatically submit payment form. Would be great if you can review your changes one more time. Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
pabloaicommented, Mar 24, 2021

Hi @TarasVerbniak, and thanks for reaching out.

The only change introduced in that PR is an addition of an error message when the submit method is called when PayPal is selected. Before the PR, the submit would just fail. The reason for this is that the PayPal SDK doesn’t allow the flow to be triggered programatically, as discussed in paypal/paypal-checkout-components#522.

One thing you could do is to indeed set the showPayButton prop as false to have the chance to select PayPal in the Drop-in but to show the button somewhere else in the page using the PayPal Component.

I hope this clarifies things. Have a nice day, and feel free to reach out again!

0reactions
yuzhakovvvcommented, Oct 29, 2021

Here is a rough example from our React codebase:

     const config  = { ... };
     ...
     
     const [isPayPalSelected, setIsPayPalSelected] = useState(false);
     ...

     const dropInCheckout = await AdyenCheckout({
        ...config,
        showPayButton: false,
      });

      const payPalCheckout = await AdyenCheckout({
        ...config,
        showPayButton: true,
      });

      const dropIn = dropInCheckout
        .create("dropin", {
          onSelect: (component: { props: { name: string } }) => {
            setIsPayPalSelected(component.props.name === "PayPal");
          },
        })
        .mount(paymentContainerRef.current);

      payPalCheckout
        .create("paypal")
        .mount(payPalContainerRef.current);

      ...

      return (
         <div>
           <div ref={paymentContainerRef}></div>
          
           <div style={{ display: isPayPalSelected ? "block" : "none" }}>
                <div ref={payPalContainerRef}></div>
           </div>

           <div style={{ display: !isPayPalSelected ? "block" : "none" }}>
                <button onClick={() => { dropIn.submit(); }>Pay</button>
           </div>
         </div>
       );
Read more comments on GitHub >

github_iconTop Results From Across the Web

Solving problems with a PayPal purchase
Many disputes are caused by misunderstandings, and they're often easy to resolve. However, if you and the seller can't reach an agreement on...
Read more >
Disputes, claims, chargebacks, and bank reversals. - PayPal
A buyer may file a dispute for two different reasons: Item Not Received (INR). In this case, the buyer is claiming they ordered...
Read more >
why won't-my-payment-with-paypal-go-through
why won't-my-payment-with-paypal-go-through.
Read more >
Questions about Pay in 4 application and repayments - PayPal
My Pay in 4 application has been declined. Why? If your application gets declined, you can still use PayPal to check out securely...
Read more >
PayPal Help Center Home
PayPal is the global leader in online payment transactions. Find answers to your common online payment questions & more here!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found