yarn add react-stripe-checkout
....................................................................................................................................................................................................................................
import React, { Component } from 'react';
import StripeCheckout from 'react-stripe-checkout'
class App extends Component {
constructor(props){
super(props)
this.state={
amount:1000
}
}
render() {
const handleToken = (token, address) => {
console.log({ token, address })
}
return (
<div>
<StripeCheckout
stripeKey='pk_test_7T8sgxrwYgpANJyhkFMeRggQ00' //<==Publishable key
token={handleToken}
billingAddress
shippingAddress
amount={this.state.amount}
/>
</div>
);
}
}
export default App;
....................................................................................................................................................................................................................................
import React, { Component } from 'react';
import StripeCheckout from 'react-stripe-checkout'
class App extends Component {
constructor(props){
super(props)
this.state={
amount:1000
}
}
render() {
const handleToken = (token, address) => {
console.log({ token, address })
}
return (
<div>
<StripeCheckout
stripeKey='pk_test_7T8sgxrwYgpANJyhkFMeRggQ00' //<==Publishable key
token={handleToken}
billingAddress
shippingAddress
amount={this.state.amount}
/>
</div>
);
}
}
export default App;
No comments:
Post a Comment