Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

43 lines
853 B

  1. <template>
  2. <div>
  3. <h4>Billing</h4>
  4. <div id="payment-element"></div>
  5. <div id="message"></div>
  6. <button @click="submit" class="btn btn-primary">Submit</button>
  7. </div>
  8. </template>
  9. <script setup>
  10. import { ref, onMounted } from "vue"
  11. const props = defineProps(["sub"])
  12. const stripe = Stripe(process.env.STRIPE_KEY)
  13. const options = { clientSecret: props.sub.clientSecret }
  14. const elements = stripe.elements(options)
  15. const payEl = elements.create("payment")
  16. function submit() {
  17. let result = stripe.confirmPayment({
  18. //`Elements` instance that was used to create the Payment Element
  19. elements,
  20. confirmParams: {
  21. return_url: `https://${window.location.host}/app`,
  22. }
  23. })
  24. }
  25. onMounted(() => {
  26. payEl.mount("#payment-element")
  27. })
  28. </script>
  29. <style scoped>
  30. button.btn {
  31. margin: 10px auto;
  32. display: block;
  33. min-width: 90px;
  34. }
  35. </style>