Save currency to db (#3086)
* Save currency to db * Add missing translation * Get currency from user credentials server side * Adds stripe data schema Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: zomars <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
3 files changed
+40
-4
No files matched your search
@@ -1,13 +1,26 @@
|
||||
import Stripe from "stripe";
|
||||
import { z } from "zod";
|
||||
|
||||
export type PaymentData = Stripe.Response<Stripe.PaymentIntent> & {
|
||||
stripe_publishable_key: string;
|
||||
stripeAccount: string;
|
||||
};
|
||||
|
||||
export type StripeData = Stripe.OAuthToken & {
|
||||
default_currency: string;
|
||||
};
|
||||
export const stripeOAuthTokenSchema = z.object({
|
||||
access_token: z.string().optional(),
|
||||
scope: z.string().optional(),
|
||||
livemode: z.boolean().optional(),
|
||||
token_type: z.literal("bearer").optional(),
|
||||
refresh_token: z.string().optional(),
|
||||
stripe_user_id: z.string().optional(),
|
||||
stripe_publishable_key: z.string().optional(),
|
||||
});
|
||||
|
||||
export const stripeDataSchema = stripeOAuthTokenSchema.extend({
|
||||
default_currency: z.string(),
|
||||
});
|
||||
|
||||
export type StripeData = z.infer<typeof stripeDataSchema>;
|
||||
|
||||
const stripePrivateKey = process.env.STRIPE_PRIVATE_KEY!;
|
||||
|
||||
|
||||
Reference in new issue
Block a user