I am quite new to reacjs and stuggle to create a reactjs component for paypal's in-context express checkout windows - it is simple to do in plain javascript but not sure how I can create a component and use it in similar way as react-stripe-checkout? thanks
-
I had the same issue setting up Paypal in my React application. Stripe can be a great alternative when accepting payments with credit card. I'm the author of the article, but it is a step by step guide to set it up.Robin Wieruch– Robin Wieruch2017-09-28 14:03:17 +00:00Commented Sep 28, 2017 at 14:03
-
Otherwise, checkout this step-by-step guide to integrate PayPal in a React component by using PayPal's REST API.Robin Wieruch– Robin Wieruch2018-02-06 20:22:27 +00:00Commented Feb 6, 2018 at 20:22
Add a comment
|
1 Answer
Please use react-paypal-express-checkout (I'm the author):
Install:
npm install --save react-paypal-express-checkout
Simplest Example (but it will show the Paypal express check out button):
import React from 'react';
import PaypalExpressBtn from 'react-paypal-express-checkout';
export default class MyApp extends React.Component {
render() {
const client = {
sandbox: 'YOUR-SANDBOX-APP-ID',
production: 'YOUR-PRODUCTION-APP-ID',
}
return (
<PaypalExpressBtn client={client} currency={'USD'} total={1.00} />
);
}
}
==========
There is also a full example, in which you can have all types of callback function (e.g. completed payment-ID, return-URL etc.)
For full detailed document (as well as official guides from Paypal,) please go here:
https://github.com/thinhvo0108/react-paypal-express-checkout