import type { CheckoutStatusResponse, CommerceInvoiceView, CommerceOrderView, CreateCheckoutSessionPayload, CreateCheckoutSessionResult, PaymentHistoryItem, PortalSessionResult, SubscriptionView } from '../types/payment'; /** * Paths mirror `com.induseuro.payment.controller.PaymentController` (`/api/v1/payments`) * and app commerce routes (`/api/commerce/*`). */ export interface PaymentApiPaths { createCheckoutSession: string; createPortalSession: string; /** * Base path before `/{sessionId}/status` for * `GET …/checkout-session/{sessionId}/status`. */ checkoutSessionBasePath: string; paymentHistory: string; cancelRazorpaySubscription: string; currentSubscription: string; listInvoices: string; listOrders: string; /** `GET` invoice file; use `{id}` placeholder, e.g. `/api/commerce/invoices/{id}/download` */ invoiceDownload: string; } /** @deprecated Use `PaymentApiPaths` */ export type PaymentCheckoutApiPaths = PaymentApiPaths; export interface PaymentCheckoutIntegrationConfig { /** API origin, e.g. `https://api.example.com` or empty string for same-origin / Next.js rewrite */ baseURL: string; paths?: Partial; /** Sent as `X-tenant` on every request when set (backend tenant context). */ tenant?: string; /** * Must include `Authorization: Bearer ` for `/api/v1/payments/**` (see `SecurityConfig` — authenticated). */ getHeaders?: () => Record | Promise>; credentials?: RequestCredentials; fetchImpl?: typeof fetch; } /** * REST helpers aligned with backend payment APIs (`PaymentController`, commerce invoices/orders, `ApiResponse`). */ export declare function createPaymentCheckoutHandlers(config: PaymentCheckoutIntegrationConfig): { /** * `POST /api/v1/payments/create-checkout-session` — body matches `CreateCheckoutRequest` * (`planId`, optional `couponCode`, `vendor` for Stripe vs Razorpay). */ createCheckoutSession: (payload: CreateCheckoutSessionPayload) => Promise; /** * `GET /api/v1/payments/checkout-session/{sessionId}/status` — Stripe session id or Razorpay subscription id. */ getCheckoutSessionStatus: (sessionId: string) => Promise; /** * `POST /api/v1/payments/create-portal-session` — Stripe Customer Portal (not available for Razorpay-only subs on server). */ createPortalSession: () => Promise; /** `GET /api/v1/payments/payment-history` */ getPaymentHistory: () => Promise; /** `GET /api/commerce/invoices` */ listInvoices: () => Promise; /** * `GET /api/commerce/orders` — override `paths.listOrders` if your app exposes a different route. */ listOrders: () => Promise; /** * `GET /api/v1/payments/subscription` — override `paths.currentSubscription` if your app differs. * Returns `null` when the API responds with no subscription payload. */ getCurrentSubscription: () => Promise; /** `POST /api/v1/payments/razorpay/subscription/cancel` */ cancelRazorpaySubscription: () => Promise; /** * `GET /api/commerce/invoices/{id}/download` — returns PDF bytes, or follows `{ url }` in JSON `data`. */ downloadInvoice: (invoiceId: number) => Promise; }; export type PaymentCheckoutHandlers = ReturnType; /** Alias for apps using checkout + billing in one client. */ export declare const createPaymentApiHandlers: typeof createPaymentCheckoutHandlers; export type PaymentApiHandlers = PaymentCheckoutHandlers; //# sourceMappingURL=createPaymentCheckoutHandlers.d.ts.map