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.

Expected intent=tokenize to be passed to SDK, but got intent=capture

See original GitHub issue

General information

  • SDK version: 3.69.0
  • Environment: Sandbox
  • Browser and OS: Google Chrome | 86.0.4240.198 (Official Build) (x86_64) on MacOS 11.0.1

Issue description

We are trying to move to the latest braintree-web SDK and we encounter some questions regarding error messages with Paypal Checkout. We are using a billing agreement (with saving payment method to Braintree user) and with the received token we authorize payment on the server-side.

This is our old code for braintree-web@2.32.1

  braintree.setup(braintreeClient, 'custom', {
    paypal: {
      singleUse: false,
      currency: 'USD',
      locale: 'en_us',
      enableShippingAddress: true,
      headless: true
    },
    dataCollector: {
      kount: { environment },
      paypal: true
    },
    onPaymentMethodReceived: (paymentMethod) => {
      this.payWithNewPayPal(paymentMethod);
    },
    onReady: (payPalIntegration) => {
      setPayPalIntegration(payPalIntegration);
    }
  });

New code with latest braintree-web version typed in React

   const [isPaypalLoaded, setIsPaypalLoaded] = useState(false);

   useEffect(() => {
    if (clientInstance !== null) {
      PaypalCheckout.create({
        client: clientInstance
      })
        .then((paypalCheckoutInstance) => {
          paypalCheckoutInstance.loadPayPalSDK({
            vault: true
          })
         .then(() => {
            window.PayPalButton = window.paypal.Buttons.driver('react', {
              React,
              ReactDOM
            });
            setIsPaypalLoaded(true);
         });
      });
    }, [clientInstance]);

  if (!isPaypalLoaded) {
    return null;
  }

  const { PayPalButton } = window;
  return (
    <PayPalButton
      style={PAYPAL_BUTTON_STYLE}
      fundingSource={window.paypal.FUNDING.PAYPAL}
      createBillingAgreement={() => (
        paypalCheckoutInstance.createPayment({
         flow: 'vault',
         intent: 'authorize',
         enableShippingAddress: true,
         currency: 'USD'
        })
      )}
      onApprove={(data) => (
        paypalCheckoutInstance.tokenizePayment(data)
          .then((payload) => {
            onTokenize(payload);
        })
      )}
      onCancel={handleCancel}
      onError={handleError}
      onInit={handleInit}
    />
  );

And with that code I was getting warning for wrong SDK intent setting image I tried to find any documentation on intent=tokenize, and to google that, but nothing. Can someone help with this error? Thanks, and sorry for the long post.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
crookedneighborcommented, Mar 24, 2021

Thanks for the info. Just so you know, we don’t maintain those type definitions. The next major version of the Braintree web SDK will be written in Typescript, which will (eventually) make using those type definitions unnecessary.

1reaction
crookedneighborcommented, Mar 24, 2021

No ETA at the moment, though we are actively working on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors: Use intent=capture to use client-side capture [Paypal ...
I am using the PayPal javascript SDK to create a Paypal subscription button for my web page, the problem resides when testing the...
Read more >
How can I solve "Error: (Integration issue) "Expected intent ...
AUTH: The payment is first authorized; capture can occur immediately or separately, at a later time. This error happens because PayPal is set...
Read more >
PayPalCheckout - Documentation - Braintree Open Source
If sale is used, it will be converted to capture for the PayPal SDK. If the vault: true param is used, tokenize will...
Read more >
Expected intent=subscription to be passed to SDK
Hi,. I am using setup instructions from this link here: here. It pretty much works except I am getting following warning in chrome:....
Read more >
JavaScript SDK script configuration - PayPal Developer
You can configure and customize your integration by passing query ... intent, capture , authorize , subscription , tokenize, capture ...
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