|
|
@@ -29,7 +29,9 @@ |
|
|
|
<div :class="{right: !selectSaved}" class="menu-slider"><div></div></div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<payment-card :stripe="stripe" v-if="!selectSaved"></payment-card> |
|
|
|
<payment-card @set-card="(c) => {card = c}" @card-valid="(val) => {cardValid = val}" |
|
|
|
@update-billing-name="billingName = $event.target.value" :stripe="stripe" |
|
|
|
v-if="!selectSaved"></payment-card> |
|
|
|
|
|
|
|
<div id="payment-error"></div> |
|
|
|
</section> |
|
|
@@ -74,6 +76,7 @@ function getSecret() { |
|
|
|
|
|
|
|
//Gets key from the server then sends it with stripe |
|
|
|
function pay() { |
|
|
|
console.log() |
|
|
|
this.getSecret().then(secret => { |
|
|
|
if (!secret) {return} |
|
|
|
this.loading = true |
|
|
@@ -82,8 +85,9 @@ function pay() { |
|
|
|
card: this.card, |
|
|
|
billing_details: {name: |
|
|
|
document.getElementById('billing-name').value}, |
|
|
|
setup_future_usage: document.querySelector('#save-card input') == 'on' ? 'off_session' : null |
|
|
|
} |
|
|
|
}, |
|
|
|
setup_future_usage: document.querySelector( |
|
|
|
"#save-card input").value == 'on' ? 'off_session' : null |
|
|
|
}) |
|
|
|
}).then(result => { |
|
|
|
if (result.error) { |
|
|
@@ -106,7 +110,7 @@ export default { |
|
|
|
return {packs: {credits10: 0, credits50: 0, |
|
|
|
credits100: 0, credits1000: 0}, loading: false, stripe: |
|
|
|
Stripe(process.env.VUE_APP_STRIPE_KEY), card: |
|
|
|
null, cardValid: false, billingName: null, selectSaved: true} |
|
|
|
null, billingName: null, selectSaved: true, cardValid: false} |
|
|
|
}, |
|
|
|
computed: {total}, |
|
|
|
methods: {getSecret, pay}, |
|
|
|