mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
23 lines
612 B
TypeScript
23 lines
612 B
TypeScript
import { CheckoutSessionRequest, CheckoutSessionResponse } from "../handlers/checkout-session"
|
|
|
|
export type FetchCheckoutSessionOptions = CheckoutSessionRequest['body']
|
|
|
|
export const fetchCheckoutSession = async ({
|
|
id,
|
|
priceId
|
|
}: FetchCheckoutSessionOptions) => {
|
|
const response = await fetch('/api/stripe/checkout-session', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
id,
|
|
priceId
|
|
})
|
|
});
|
|
|
|
const json: CheckoutSessionResponse = await response.json();
|
|
|
|
return json;
|
|
} |