Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
966 views
in Technique[技术] by (71.8m points)

reactjs - how can I create a react component for paypal in-context express checkout?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...