如何为贝宝上下文快速结账创建反应组件? [英] how can I create a react component for paypal in-context express checkout?
问题描述
我对 reacjs 很陌生,并且努力为 paypal 的上下文快速结帐窗口 - 在普通的 javascript 中很简单,但不确定如何创建组件并以与 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
(我是作者强>):
安装:
npm install --save react-paypal-express-checkout
最简单的示例(但它会显示 Paypal 快速结账按钮):
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
这篇关于如何为贝宝上下文快速结账创建反应组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!