Skip to content

Commit ad98fe2

Browse files
chore: wip
1 parent 10e19fb commit ad98fe2

File tree

8 files changed

+38
-810
lines changed

8 files changed

+38
-810
lines changed

app/Actions/Payment/CreateSubscriptionAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export default new Action({
1414

1515
const subscription = await user?.newSubscription(plan, type)
1616

17-
return subscription
17+
return subscription?.paymentIntent
1818
},
1919
})

resources/views/dashboard/components/billing/plans.vue

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -56,42 +56,27 @@ async function subscribePlan() {
5656
body: JSON.stringify(body),
5757
})
5858
59-
const client = await response.json()
59+
const client: any = await response.json()
6060
61-
console.log(client)
61+
const clientSecret = client.client_secret
6262
6363
stripe = await loadStripe(publishableKey)
6464
65-
// if (stripe) {
66-
// elements = stripe.elements({clientSecret});
67-
// const paymentElement = elements.create('payment');
65+
if (stripe) {
66+
elements = stripe.elements({clientSecret});
67+
const paymentElement = elements.create('payment');
6868
69-
// paymentElement.mount("#payment-element");
70-
// const linkAuthenticationElement = elements.create("linkAuthentication");
71-
// linkAuthenticationElement.mount("#link-authentication-element");
69+
paymentElement.mount("#payment-element");
70+
const linkAuthenticationElement = elements.create("linkAuthentication");
71+
linkAuthenticationElement.mount("#link-authentication-element");
72+
}
7273
73-
// }
74+
loading.value = false
7475
}
7576
</script>
7677

7778
<template>
78-
<div class="flex space-x-4">
79-
<div v-show="!loading" class="w-2/3 rounded-md bg-white px-8 py-6 shadow-md">
80-
<form id="payment-form">
81-
<div id="link-authentication-element">
82-
<!-- Stripe.js injects the Link Authentication Element -->
83-
</div>
84-
<div id="payment-element">
85-
<!-- Stripe.js injects the Payment Element -->
86-
</div>
87-
<button id="submit" class="primary-button">
88-
<div id="spinner" class="spinner hidden" />
89-
<span id="button-text">Pay now</span>
90-
</button>
91-
<div id="payment-message" class="hidden" />
92-
</form>
93-
</div>
94-
</div>
79+
9580

9681
<div class="mx-auto px-4 py-8 container lg:px-8">
9782
<div class="flex justify-center">
@@ -113,6 +98,23 @@ async function subscribePlan() {
11398
</p>
11499
</div>
115100

101+
<div v-show="!loading" class="w-2/3 rounded-md bg-white px-8 py-6 shadow-md">
102+
<form id="payment-form">
103+
<div id="link-authentication-element">
104+
<!-- Stripe.js injects the Link Authentication Element -->
105+
</div>
106+
<div id="payment-element">
107+
<!-- Stripe.js injects the Payment Element -->
108+
</div>
109+
<button id="submit" class="primary-button">
110+
<div id="spinner" class="spinner hidden" />
111+
<span id="button-text">Pay now</span>
112+
</button>
113+
<div id="payment-message" class="hidden" />
114+
</form>
115+
</div>
116+
117+
<div v-if="loading">
116118
<div class="pt-8">
117119
<div class="flex justify-center">
118120
<fieldset aria-label="Payment frequency">
@@ -165,7 +167,7 @@ async function subscribePlan() {
165167
<span class="text-gray-900 font-medium">Pro</span>
166168

167169
<p class="pt-2 text-xs text-gray-600">
168-
All Stacks features are included & being able to add team members.
170+
All Stacks features are included & being able to invite team members.
169171
</p>
170172
</span>
171173
</span>
@@ -188,6 +190,8 @@ async function subscribePlan() {
188190
Subscribe
189191
</button>
190192
</div>
193+
194+
</div>
191195
</div>
192196
</div>
193197
</div>

resources/views/dashboard/settings/billing.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const loading = ref(true)
1111
async function initialize() {
1212
stripe = await loadStripe(publishableKey)
1313
14-
const { clientSecret } = await fetch('http://localhost:3008/stripe/create-subscription').then(res => res.json()) as any
14+
const { clientSecret } = await fetch('http://localhost:3008/stripe/create-setup-intent').then(res => res.json()) as any
1515
1616
if (stripe) {
1717
elements = stripe.elements({ clientSecret })
@@ -22,7 +22,7 @@ async function initialize() {
2222
linkAuthenticationElement.mount('#link-authentication-element')
2323
}
2424
25-
// isLoading.value = false
25+
loading.value = false
2626
}
2727
2828
async function payPlan() {
@@ -39,9 +39,9 @@ async function payPlan() {
3939

4040
<template>
4141
<div class="mx-auto px-4 py-8 container lg:px-8">
42-
<Plans />
42+
<Plans v-if="false"/>
4343

44-
<div v-if="false" id="subscribed">
44+
<div id="subscribed">
4545
<div class="sm:flex sm:items-center">
4646
<div class="sm:flex-auto">
4747
<h1 class="text-base text-gray-900 font-semibold leading-6">

storage/framework/core/components/dropdown/src/components/Expand.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async function handleCopyCode() {
6363
Default
6464
</button>
6565
</div>
66-
<div class="code-block group relative">
66+
<div class="group code-block relative">
6767
<Highlight
6868
language="javascript"
6969
class-name="rounded-md text-xs"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'StripeProduct' | 'Subscription' | 'Error'
1+
export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'Subscription' | 'Error'

storage/framework/database/models/generated/StripeProduct.ts

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)