feat: add course checkout UI and stripe integration and webhook wip

This commit is contained in:
swve 2024-11-01 20:51:52 +01:00
parent d8913d1a60
commit 1bff401e73
18 changed files with 1086 additions and 131 deletions

View file

@ -73,4 +73,21 @@ export async function getCoursesLinkedToProduct(orgId: number, productId: string
return res;
}
export async function getProductsByCourse(orgId: number, courseId: string, access_token: string) {
const result = await fetch(
`${getAPIUrl()}payments/${orgId}/courses/${courseId}/products`,
RequestBodyWithAuthHeader('GET', null, null, access_token)
);
const res = await getResponseMetadata(result);
return res;
}
export async function getStripeProductCheckoutSession(orgId: number, productId: number, redirect_uri: string, access_token: string) {
const result = await fetch(
`${getAPIUrl()}payments/${orgId}/stripe/checkout/product/${productId}?redirect_uri=${redirect_uri}`,
RequestBodyWithAuthHeader('POST', null, null, access_token)
);
const res = await getResponseMetadata(result);
return res;
}