paypal-js | Loading wrapper and TypeScript types for the PayPal JS SDK | SDK library

 by   paypal TypeScript Version: v6.0.0 License: Apache-2.0

kandi X-RAY | paypal-js Summary

kandi X-RAY | paypal-js Summary

paypal-js is a TypeScript library typically used in Utilities, SDK, Vue, Angular, Nodejs applications. paypal-js has no vulnerabilities, it has a Permissive License and it has low support. However paypal-js has 4 bugs. You can download it from GitHub.

A client-side loader for the PayPal JS SDK.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              paypal-js has a low active ecosystem.
              It has 144 star(s) with 72 fork(s). There are 37 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 12 open issues and 52 have been closed. On average issues are closed in 18 days. There are 10 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of paypal-js is v6.0.0

            kandi-Quality Quality

              paypal-js has 4 bugs (0 blocker, 0 critical, 4 major, 0 minor) and 0 code smells.

            kandi-Security Security

              paypal-js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              paypal-js code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              paypal-js is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              paypal-js releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.
              It has 155 lines of code, 0 functions and 31 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed paypal-js and discovered the below as its top functions. This is intended to give you an instant insight into paypal-js implemented functionality, and help decide if they suit your requirements.
            • Return the banner text for the pacak
            Get all kandi verified functions for this library.

            paypal-js Key Features

            No Key Features are available at this moment for paypal-js.

            paypal-js Examples and Code Snippets

            No Code Snippets are available at this moment for paypal-js.

            Community Discussions

            QUESTION

            PayPal Donate button in React: Donate SDK or Checkout SDK integration?
            Asked 2022-Mar-29 at 04:26

            The official NPM package @paypal/react-paypal-js: https://www.npmjs.com/package/@paypal/react-paypal-js only supports buttons that require client_id, I have not been able to find anything that simplifies the implementation of Donate button. PayPal provides only this HTML code below on the Donate button documentation. Please let me know if anyone has had a similar experience and how did you manage to implement it properly in React/Gatsby.

            ...

            ANSWER

            Answered 2022-Mar-29 at 04:26

            There are two ways to use the Donate SDK HTML/JS from react.

            1. Configure the app to load the SDK script at page load time (typically as part of the page's ). The JS to render the button can then be run/outputted whenever as part of a component.

            2. Insert the script element into the DOM after page load and once loaded render buttons with a callback function. This can all be placed in a React component's useEffect or similar. The linked example using loadAsync is for the Checkout SDK, but that's easily swapped out for Donate SDK code.

            You can use the Donate SDK with a hosted_button_id as you mentioned (created at https://www.paypal.com/buttons (live) or www.sandbox.paypal.com/buttons) -- or alternatively, instead of a hosted button id just pass a business parameter with either the receiving account's PayPal email address or (ideally) its PayPal Merchant ID (since that will never change whereas an email can be removed from the account and no longer point to it)

            Later edit: Note that the Donate SDK is separate from simply relabeling a normal PayPal Checkout SDK button with the text "Donate", which can be done per the react-paypal-js storybook example, as another answer mentioned. The issue with this approach is after clicking the button it will look like a standard PayPal checkout, not a donation-specific flow...

            Using the actual Donate SDK instead results in a more tailored donor flow where they can select any amount in the large input, and even check an option to make their donation recurring:

            Source https://stackoverflow.com/questions/71638273

            QUESTION

            PayPal subscription API onApprove
            Asked 2022-Mar-25 at 19:30

            I'm trying to implement the PayPal Subscription API but I'm not sure about the process flow.
            I use the react-paypal-js package to generate the subscription button.
            The way the users are created on my website is only through the Paypal subscription.

            The process is as follow:

            1. The user choose a plan and click on the subscribe button
            2. The PayPal window open and the user follows the subscription process on Paypal
            3. The user is redirected to my website
            4. Using webhooks or with the onApprove callback, I receive the newly created subscription, create a user on my website with the Paypal email address associated with the subscription.

            It all works. My problem is that I need to check, before accepting the subscription, if I already have a local user with given email and in this case, I don't want to accept the subscription (as I would then have 2 subscriptions for the same user) and display a message saying that their is already an active (or suspended) subscription associated with the given email.

            As far as I can tell, when the onApprove is called or the webhook is called, the subscription has already been processed and activated.

            Thanks!

            ...

            ANSWER

            Answered 2022-Mar-25 at 19:30

            You don't have to design a system in which the PayPal email used to make the payment, and the email of the user used to log into your site, have a 1:1 relationship. Instead you can have the user log and create their account with you first (as they will always need that to manage something subscription-based) and then you will know there is no subscription associated with that user before displaying the PayPal Subscribe button. Then they can pay with any PayPal account (might be the same email, might be different)

            As far as I can tell, when the onApprove is called or the webhook is called, the subscription has already been processed and activated.

            That is the default behavior, yes. Per the above it shouldn't be ncessary, but you can change the subscription to start in an inactive state, and show a final review step on your site that will activate it via API. This is controlled by setting application_context -> user_action -> CONTINUE (vs default SUBSCRIBE_NOW). See the API reference for subscription create, and you would of course need to use the subscription activate API call as a final step after confirmation.

            Source https://stackoverflow.com/questions/71614931

            QUESTION

            How to have a custom handler instead of a PayPal button in React?
            Asked 2022-Feb-25 at 22:49

            I have a website with multiple payment forms. I can switch between them and then I have a button with "Continue to checkout" label that when you click, it does something depending on the payment method chosen. The handler function looks something like this:

            ...

            ANSWER

            Answered 2022-Feb-25 at 22:49

            If you use the PayPal JS SDK to open the checkout, you have to use its button, and the user has to click it themselves. PayPal does this intentionally so that the button shown uses their consistent branding.

            If you want an alternative, you can integrate without the JS SDK (REST API only) and have your own button which redirects to the PayPal page for approval, which will then return to your site. This is an old integration pattern, for old websites, and not recommended.

            Despite your misgivings and desire not to use it, the JS SDK and its button in a container sized to your requirements is in fact the best available solution.

            Based on the UI shown, what you might op to do is hide your "Pay" button and replace it with one that says "Pay With PayPal" when that method is selected, which could look like this (sized to fit your container): Here's sample HTML/JS for that, you can do the same from react-paypal-js :

            Source https://stackoverflow.com/questions/71266823

            QUESTION

            Why paymentID is null after PayPal transaction?
            Asked 2022-Feb-05 at 06:46

            I'm using PayPal in sandbox mode and @paypal/react-paypal-js in my React application and I'm using .NET 5 as my REST API. Here is my payload when I want to create an order:

            ...

            ANSWER

            Answered 2022-Feb-05 at 06:46

            Within onApprove, the order hasn't been captured when you are printing that data. Capture the order first. When an order is captured, its transaction ID will be in the response's purchase_units[0].payments.captures[0]

            If you need to do anything important with that ID, such as store it in a database, used a server-side integration (not actions.order.capture nor actions.order.create, client-side code is not for database operations). See the optional step #5 in the 'Add and modify the code' section of the guide for Integrate Checkout, and be sure to use the client-side error handling code in its linked demo pattern example.

            Source https://stackoverflow.com/questions/70995809

            QUESTION

            any idea how to pass down style props in to @paypal/paypal-js PayPalButtons component?
            Asked 2022-Jan-19 at 00:33

            I am using @paypal/paypal-js from npm in react app to integrate payment, any idea how to pass down style props in the button component that this library offers ?

            ...

            ANSWER

            Answered 2022-Jan-19 at 00:33

            There are some examples in the documentation. For your case:

            Source https://stackoverflow.com/questions/70763943

            QUESTION

            how to implement paypal suspend subscription on reactjs
            Asked 2022-Jan-01 at 09:49

            Hi i've been using paypal's sample code but adapted with react-paypal-js.

            I'm wondering if there is an example for suspend subscription?

            There doesn't seem to be an equivalent suspendSubscription? I tried looking at subscription API but not sure how to adapt that here. Thanks!

            ...

            ANSWER

            Answered 2022-Jan-01 at 09:49

            Suspending a subscription is done with server API calls, so reactjs is not relevant.

            See the Subscriptions documentation, which gives an example in curl format

            Source https://stackoverflow.com/questions/70547662

            QUESTION

            Pre-fill PayPal Billing details for credit card
            Asked 2021-Oct-29 at 16:00

            Trying to pre-fill some details for the card payment based on https://developer.paypal.com/docs/checkout/integration-features/standard-card-fields/. But the example https://developer.paypal.com/docs/checkout/integration-features/standard-card-fields/ is not working, because the json does not fit to the types in "@paypal/paypal-js": "^4.1.0".

            So I adjusted it --> https://developer.paypal.com/docs/api/orders/v2/#definition-payer See also: @paypal\paypal-js\types\apis\orders.d.ts

            But now the following error accours:

            ...

            ANSWER

            Answered 2021-Oct-29 at 16:00

            Per the documentation, phone_number must have a national_number key. Do not include a payer_id or invalid tax_info object.

            Source https://stackoverflow.com/questions/69770637

            QUESTION

            Passing both user ID and product ID to Paypal Button
            Asked 2021-Oct-21 at 06:58

            I am using @paypal/react-paypal-js to display the PayPal button and create an order. I am specifically interested in processing credit card payments. Once my Django backend receives the payment capture completion event from PayPal, it needs to store information about a particular user owning a particular product. Hence, the notification has to contain both the user ID (i.e. email) and the product ID.

            This is how I am trying to pass these two pieces of information in my frontend:

            ...

            ANSWER

            Answered 2021-Oct-21 at 02:03

            I also tried adding payee: {email_address: userEmail} into purchase_units, but then there was no option to pay with credit card after pressing on the PayPal button. That option got replaced by the option to create a PayPal account.

            payee sets which account receives the PayPal payment. The black Debit or Credit Card button will generally be available for guest payments if the recipient PayPal account exists and is confirmed.

            How can I pass the two pieces of information so as to get them in webhook_event?

            If you absolutely must store two pieces information as part of a custom value (usually only useful for subscriptions, although even for subscriptions there are better solutions that involve using your own database), you could encode a JSON object with json.dumps({'email': somevalue, 'product': somevalue} and store that json string value in custom_id -- then decode it later on receipt with json.loads.

            It's unusual to need to do anything like this, however, especially for one-time Order payments. You should implement order creation and capture from your own server routes and store the necessary information on your own database immediately on successful capture, before returning the capture result to the button JavaScript. See the information for a server integration in Set up standard payments.

            Webhooks are not necessary at all in such a case, much less retrieving item information from a webhook. You however can and should include item information as part of the PayPal transaction for informational purposes, via an items array. This will also show to the payer in the upper right cart dropdown during checkout, and be visible in the completed paypal.com transaction details.

            Source https://stackoverflow.com/questions/69653859

            QUESTION

            How to pass dynamic amount to Paypal React SDK Button without re-render
            Asked 2021-Sep-21 at 09:30

            I'm using react-paypal-js and need to set a dynamic amount when the PayPal button is clicked.

            The problem: the createOrder function can not take data from my state (might because it is under PayPal script context).

            Not Working Example:

            ...

            ANSWER

            Answered 2021-Sep-21 at 09:30

            Integrating from a backend is the most robust solution in general, especially for ecommerce -- but as this is for a simple donation use case I can see how you may wish to avoid that.

            There are various possible solutions, including using an additional state framework such as Redux, but it seems what you want to do is manage the state at a parent component level above the buttons, and bind its createOrder ("handleCreatePayPal") methods, etc so that this is in context and they can access its state.

            Here is a runnable codesandbox example (based on the documented example that uses a re-render, but none is done here)

            Source https://stackoverflow.com/questions/69259922

            QUESTION

            Disable shipping address with react-paypal-js
            Asked 2021-Jun-09 at 12:06

            Hi I am using this module to integrate the Paypal solution in my site: https://www.npmjs.com/package/@paypal/react-paypal-js

            However even though it seems to be developed by paypal officially, there seems to be no option to disable the shipping address during checkout

            ...

            ANSWER

            Answered 2021-Jun-09 at 12:06

            After digging through the source code you can supply many options.. I was able to set no shipping address like this:

            Source https://stackoverflow.com/questions/67903758

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install paypal-js

            To get started, install paypal-js with npm.

            Support

            This library relies on JavaScript Promises. To support legacy browsers like IE 11, you must provide your own Promise polyfill. With a Promise polyfill this library will support the same browsers as the JS SDK.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/paypal/paypal-js.git

          • CLI

            gh repo clone paypal/paypal-js

          • sshUrl

            git@github.com:paypal/paypal-js.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular SDK Libraries

            WeiXinMPSDK

            by JeffreySu

            operator-sdk

            by operator-framework

            mobile

            by golang

            Try Top Libraries by paypal

            glamorous

            by paypalJavaScript

            PayPal-PHP-SDK

            by paypalPHP

            junodb

            by paypalGo

            react-engine

            by paypalJavaScript