如何为PayPal上下文快速结帐创建React组件? [英] how can I create a react component for paypal in-context express checkout?
问题描述
我对reacjs相当陌生,并努力为 react-stripe-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
推荐答案
请使用react-paypal-express-checkout
( 我是作者 ):
Please use react-paypal-express-checkout
(I'm the author):
安装:
npm install --save react-paypal-express-checkout
最简单的示例(但它将显示Paypal Express签出按钮):
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} />
);
}
}
==========
==========
还有一个完整的示例,其中您可以使用所有类型的回调函数(例如,完整的付款ID,返回URL等)
There is also a full example, in which you can have all types of callback function (e.g. completed payment-ID, return-URL etc.)
有关完整的详细文档(以及Paypal的官方指南),请转到此处:
For full detailed document (as well as official guides from Paypal,) please go here:
https://github.com/thinhvo0108/react-paypal-express-checkout
这篇关于如何为PayPal上下文快速结帐创建React组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!