export type CreateApiYourpayPaxStartPaymentArgs = {body: {cash_register?: number | undefined, pax?: number | undefined, amount?: number | undefined}}; export type CreateApiYourpayPaxStartPaymentOptions = {baseUrl?: string | undefined, TokenAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start Payment * * POST /yourpay-pax/start-payment */ export const createApiYourpayPaxStartPayment = async (args: CreateApiYourpayPaxStartPaymentArgs, options?: CreateApiYourpayPaxStartPaymentOptions) => { const {baseUrl = "https://api-dev.shopbox.com/api/v3", fetch: fetchFn = fetch, TokenAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (TokenAuth !== undefined) query.set("accessToken", TokenAuth) const url = `${baseUrl.replace(/\/+$/, '')}/yourpay-pax/start-payment${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };