
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-paypal-checkout-button
Advanced tools
A very simple, easy to use React button component for implementing paypal checkout
A very simple, easy to use React button component for implementing paypal checkout, now enhanced with the power of Custom Hooks 🔥 🔥
npm install --save react-paypal-checkout-button
or
yarn add react-paypal-checkout-button
import React, { useRef } from 'react'
import { usePayPalCheckout } from 'react-paypal-checkout-button'
const App = () => {
const {
isLoadingButton,
errorMessage,
buttonLoaded,
onRetry,
paypalRef
} = usePayPalCheckout({
clientId: 'a*****************************',
paypalRef,
amount: 100,
currency: 'USD',
onSuccess: (data, order) => {
console.log(data, order)
},
onError: (error) => {
console.log(error)
}
return (
{isLoadingButton && <h3>loading..</h3>}
<div ref={paypalRef} />
)
})
export default App
import React from 'react'
import PayPalCheckout from 'react-paypal-checkout-button'
import 'react-paypal-checkout-button/dist/index.css'
const App = () => {
return (
<PayPalCheckout
clientId='a*****************************'
amount={100}
currency='USD'
onSuccess={(data, order) => {
console.log(data, order)
}}
onError={(error) => {
console.log(error)
}}
/>
)
}
export default App
All relevant types are bundled and exported with the npm package
/********PayPalCheckout Types**********/
type type PayPalCheckoutProps = {
intent?: IntentOptions // 'CAPTURE' | 'AUTHORIZE'
clientId?: string
amount: number
currency?: string
description?: string
buttonStyles?: StylesOptions
onSuccess?: (data: OnApproveDataTypes, order: OrderObjectTypes) => void
onError?: (error: any) => void
}
/********usePayPalCheckout Types**********/
type UsePayPalCheckoutOptions = PayPalCheckoutProps
export type ButtonState = {
isLoadingButton: boolean
buttonLoaded: boolean
errorMessage: string
}
export type UsePayPalCheckoutValues = ButtonState & {
onRetry: () => void,
paypalRef: (node: ReactElement | HTMLElement | null | undefined) => void
}
we hope to make this package the first option whenever it comes to implemeting paypal checkout, so you are always welcome to contribute to this project.
git checkout -b feature-namegit commit -am 'Some commit messagegit push origin feature-nameMIT © UcheSylvester
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.