Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onLaunchCardForm = async () => {
try {
this.setState({ ...this.state, loading: true, token: null })
const token = await stripe.paymentRequestWithCardForm(demoCardFormParameters)
this.setState({ ...this.state, token: token.tokenId })
// We now have the token, use it to confirm
const confirmPaymentResult = await stripe.confirmPaymentIntent({
clientSecret: this.state.paymentIntent.secret,
paymentMethod: demoPaymentMethodDetailsWithToken(token.tokenId),
})
const display = confirmPaymentResult
this.setState({ ...this.state, display })
} catch (e) {
console.log(e)
this.setState({ loading: false })
}
}
handleCardPayPress = async () => {
try {
this.setState({ loading: true, token: null })
const token = await stripe.paymentRequestWithCardForm({
// Only iOS support this options
smsAutofillDisabled: true,
requiredBillingAddressFields: 'full',
prefilledInformation: {
billingAddress: {
name: 'Gunilla Haugeh',
line1: 'Canary Place',
line2: '3',
city: 'Macon',
state: 'Georgia',
country: 'US',
postalCode: '31217',
email: 'ghaugeh0@printfriendly.com',
},
},
})