Basic Stripe integration. new pages for stripe handshake and new Account page. use query instead of useQuery for trpc fetches from store
This commit is contained in:
23
pages/success.vue
Normal file
23
pages/success.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import Stripe from 'stripe';
|
||||
const config = useRuntimeConfig();
|
||||
const stripe = new Stripe(config.stripeSecretKey, { apiVersion: '2022-11-15' });
|
||||
const route = useRoute();
|
||||
let customer: Stripe.Response<Stripe.Customer | Stripe.DeletedCustomer>
|
||||
try{
|
||||
const session = await stripe.checkout.sessions.retrieve(route?.query?.session_id as string);
|
||||
customer = await stripe.customers.retrieve(session?.customer as string);
|
||||
} catch(e) {
|
||||
console.log(`Error ${e}`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<p>
|
||||
<span v-if="!customer.deleted">We appreciate your business {{customer.name}}!</span>
|
||||
<span v-if="customer.deleted">It appears your stripe customer information has been deleted!</span>
|
||||
</p>
|
||||
<p><NuxtLink to="/dashboard">To Your Dashboard</NuxtLink></p>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user