npm install react-paypal-button-v2
import { PayPalButton } from "react-paypal-button-v2";
const PayPalPayment = () => {
const paypalOptions = {
clientId: 'YOUR_PAYPAL_CLIENT_ID',
currency: 'USD',
amount: 10,
onSuccess: (details, data) => {
alert('Payment successful');
},
onError: err => {
alert('Payment failed');
},
};
return (
options={paypalOptions}
/>
);
}
ReactDOM.render(
,
document.getElementById('root')
);
本文为翻滚的胖子原创文章,转载无需和我联系,但请注明来自猿教程iskeys.com