-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
Flask==2.2.2 | ||
Werkzeug==2.2.2 | ||
python-dotenv==0.21.1 | ||
stripe==5.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,8 @@ document.addEventListener('DOMContentLoaded', async () => { | |
// Initialize Stripe Elements with the PaymentIntent's clientSecret, | ||
// then mount the payment element. | ||
const elements = stripe.elements({ clientSecret }); | ||
const addressElement = elements.create('address'); | ||
addressElement.mount('#address-element'); | ||
const paymentElement = elements.create('payment'); | ||
paymentElement.mount('#payment-element'); | ||
// Create and mount the linkAuthentication Element to enable autofilling customer payment details | ||
|
@@ -36,17 +38,18 @@ document.addEventListener('DOMContentLoaded', async () => { | |
// If the customer's email is known when the page is loaded, you can | ||
// pass the email to the linkAuthenticationElement on mount: | ||
// | ||
// linkAuthenticationElement.mount("#link-authentication-element", { | ||
// defaultValues: { | ||
// email: '[email protected]', | ||
// } | ||
// }) | ||
linkAuthenticationElement.mount("#link-authentication-element", { | ||
defaultValues: { | ||
email: '[email protected]', | ||
} | ||
}) | ||
// If you need access to the email address entered: | ||
// | ||
// linkAuthenticationElement.on('change', (event) => { | ||
// const email = event.value.email; | ||
// console.log({ email }); | ||
// }) | ||
linkAuthenticationElement.on('change', (event) => { | ||
const email = event.value.email; | ||
console.log({ email }); | ||
console.log(event); | ||
}) | ||
|
||
// When the form is submitted... | ||
const form = document.getElementById('payment-form'); | ||
|