stripe js elements code example
Example 1: stripe stripe js
npm install @stripe/stripe-js
Example 2: stripe stripe js
import {loadStripe} from '@stripe/stripe-js'; const stripe = await loadStripe('pk_test_TYooMQauvdEDq54NiTphI7jx');
Example 3: stripe elements
style: {
padding: '2rem'
}
let cardNumber = elements.create('cardNumber', {
'placeholder': '1234 1234 1234 1234',
'style': style
});
cardNumber.mount('#card-number');
let cardCvc = elements.create('cardCvc', {
'placeholder': 'CVC',
'style': style
});
cardCvc.mount('#card-cvc');
let cardExpiry = elements.create('cardExpiry', {
'placeholder': 'MM / AA',
'style': style
});
cardExpiry.mount('#card-expiry')