Add PayPal checkout provider

This commit is contained in:
Codex Agent
2026-02-04 12:18:14 +01:00
parent 972f003b26
commit 5f54adedab
33 changed files with 1586 additions and 571 deletions

View File

@@ -2760,11 +2760,11 @@ export async function getTenantLemonSqueezyTransactions(cursor?: string): Promis
};
}
export async function createTenantLemonSqueezyCheckout(
export async function createTenantPayPalCheckout(
packageId: number,
urls?: { success_url?: string; return_url?: string }
): Promise<{ checkout_url: string; id: string; expires_at?: string; checkout_session_id?: string }> {
const response = await authorizedFetch('/api/v1/tenant/packages/lemonsqueezy-checkout', {
): Promise<{ approve_url: string | null; order_id: string; status?: string; checkout_session_id?: string }> {
const response = await authorizedFetch('/api/v1/tenant/packages/paypal-checkout', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
@@ -2773,7 +2773,7 @@ export async function createTenantLemonSqueezyCheckout(
return_url: urls?.return_url,
}),
});
return await jsonOrThrow<{ checkout_url: string; id: string; expires_at?: string; checkout_session_id?: string }>(
return await jsonOrThrow<{ approve_url: string | null; order_id: string; status?: string; checkout_session_id?: string }>(
response,
'Failed to create checkout'
);
@@ -2854,7 +2854,7 @@ export async function completeTenantPackagePurchase(params: {
const payload: Record<string, unknown> = { package_id: packageId };
if (orderId) {
payload.lemonsqueezy_order_id = orderId;
payload.paypal_order_id = orderId;
}
const response = await authorizedFetch('/api/v1/tenant/packages/complete', {