{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/http.ts","../src/resources/checkout.ts","../src/resources/paymentLinks.ts","../src/resources/payments.ts","../src/resources/refunds.ts","../src/resources/webhooks.ts","../src/resources/plans.ts","../src/resources/customers.ts","../src/resources/subscriptions.ts","../src/resources/invoices.ts","../src/resources/coupons.ts","../src/resources/promotionCodes.ts","../src/resources/dunning.ts","../src/resources/tax.ts","../src/resources/qr.ts","../src/resources/account.ts","../src/resources/analytics.ts","../src/resources/providers.ts","../src/resources/sms.ts","../src/client.ts"],"sourcesContent":["export { PayBridgeNP } from \"./client\";\nexport {\n  // v3 typed error hierarchy — branch with `instanceof`.\n  PayBridgeError,\n  AuthenticationError,\n  AccountError,\n  PermissionError,\n  InvalidRequestError,\n  IdempotencyError,\n  RateLimitError,\n  ApiError,\n  ConnectionError,\n  SignatureVerificationError,\n  // Pre-3.0 names kept as deprecated aliases.\n  PayBridgeAuthenticationError,\n  PayBridgeNotFoundError,\n  NotFoundError,\n  PayBridgeInvalidRequestError,\n  PayBridgeRateLimitError,\n  PayBridgeSignatureVerificationError,\n  parseErrorResponse,\n} from \"./errors\";\nexport type { PayBridgeErrorType, SuspensionDetail, PauseDetail } from \"./errors\";\n/** @deprecated use `PayBridgeErrorType` */\nexport type { PayBridgeErrorType as PayBridgeErrorCode } from \"./errors\";\nexport type {\n  PayBridgeConfig,\n  Provider,\n  PaymentStatus,\n  Metadata,\n  CheckoutFlow,\n  CreateCheckoutParams,\n  CheckoutSession,\n  CheckoutSessionStatus,\n  ExpiredCheckoutSession,\n  RetrievedCheckoutSession,\n  SessionProvider,\n  SessionAddress,\n  ListSessionsParams,\n  PaymentLink,\n  PaymentLinkWithStats,\n  CreatePaymentLinkParams,\n  UpdatePaymentLinkParams,\n  ListPaymentLinksParams,\n  DeletedPaymentLink,\n  Payment,\n  ListPaymentsParams,\n  PaginatedResponse,\n  PaginationMeta,\n  WebhookEventType,\n  WebhookEvent,\n  CreateWebhookParams,\n  WebhookEndpoint,\n  Account,\n  AnalyticsOverview,\n  ProviderList,\n  NotifyPendingPaymentParams,\n  SmsNotifyResult,\n} from \"./types\";\n\nexport type {\n  RefundStatus,\n  RefundReason,\n  Refund,\n  CreateRefundParams,\n  ListRefundsParams,\n} from \"./types/refunds\";\n\nexport type {\n  FonepayQrCustomer,\n  CreateFonepayQrParams,\n  FonepayQrSession,\n} from \"./types/qr\";\n\nexport type {\n  // Plans\n  IntervalUnit,\n  OverdueAction,\n  BillingScheme,\n  AggregationMethod,\n  CreatePlanParams,\n  UpdatePlanParams,\n  ListPlansParams,\n  Plan,\n  // Customers\n  CreateCustomerParams,\n  UpdateCustomerParams,\n  ListCustomersParams,\n  BillingCustomer,\n  // Subscriptions\n  SubscriptionStatus,\n  CreateSubscriptionParams,\n  ListSubscriptionsParams,\n  PauseSubscriptionParams,\n  CancelSubscriptionParams,\n  ChangePlanParams,\n  ChangePlanResult,\n  ProrationBehavior,\n  ProrationPreview,\n  ExtendTrialParams,\n  EndTrialResponse,\n  Subscription,\n  CustomerRef,\n  PlanRef,\n  SubscriptionLatestInvoice,\n  // Coupons + promotion codes\n  CouponDiscountType,\n  CouponDuration,\n  Coupon,\n  CreateCouponParams,\n  ListCouponsParams,\n  PromotionCode,\n  CreatePromotionCodeParams,\n  ListPromotionCodesParams,\n  ValidatePromotionCodeParams,\n  ValidatePromotionCodeResponse,\n  ApplyCouponParams,\n  Discount,\n  // Tax\n  TaxSettings,\n  UpdateTaxSettingsParams,\n  // Usage + invoice items\n  ReportUsageParams,\n  UsageReportAck,\n  UsageRecord,\n  UsageSummary,\n  CreateInvoiceItemParams,\n  InvoiceItem,\n  // Invoices\n  InvoiceStatus,\n  ListInvoicesParams,\n  Invoice,\n  InvoiceSubscriptionRef,\n  // Dunning\n  DunningFinalAction,\n  DunningPolicy,\n  CreateDunningPolicyParams,\n  UpdateDunningPolicyParams,\n  DunningAttempt,\n  DunningInvoiceStatus,\n  // Shared\n  PaginatedBillingResponse,\n  BillingListResponse,\n} from \"./types/billing\";\n\nexport const SDK_VERSION = \"5.7.0\" as const;\n","// ---------------------------------------------------------------------------\n// PayBridgeNP SDK error classes (v3+)\n// ---------------------------------------------------------------------------\n// Mirrors the API's nested error envelope:\n//\n//   { \"error\": { \"message\": \"...\", \"type\": \"...\", \"code\": \"...\", \"request_id\": \"...\", ... } }\n//\n// `type` drives the class hierarchy below (auth → AuthenticationError, etc.)\n// so callers can branch with `instanceof` instead of comparing strings.\n// ---------------------------------------------------------------------------\n\nexport type PayBridgeErrorType =\n  | \"authentication_error\"\n  | \"account_error\"\n  | \"permission_error\"\n  | \"invalid_request_error\"\n  | \"idempotency_error\"\n  | \"rate_limit_error\"\n  | \"api_error\"\n  | \"connection_error\"\n  | \"signature_verification_error\";\n\n/** Shape of `error.suspension` returned with `account_suspended`. */\nexport type SuspensionDetail = {\n  suspended_at?: string;\n  reason?: string | null;\n};\n\n/** Shape of `error.pause` returned with `token_paused`. */\nexport type PauseDetail = {\n  paused_at?: string;\n  reason?: string | null;\n};\n\nexport class PayBridgeError extends Error {\n  /** HTTP status code, or 0 for connection / signature errors. */\n  readonly statusCode: number;\n  /** Broad category — matches `error.type` from the API. */\n  readonly type: PayBridgeErrorType;\n  /** Specific identifier — matches `error.code` from the API (may be undefined). */\n  readonly code: string | undefined;\n  /** Request ID — matches `error.request_id` and the `X-Request-Id` header. */\n  readonly requestId: string | undefined;\n  /** Full parsed JSON body of the error response. */\n  readonly raw: Record<string, unknown> | null;\n\n  constructor(\n    message: string,\n    statusCode: number,\n    type: PayBridgeErrorType,\n    options: {\n      code?: string;\n      requestId?: string;\n      raw?: Record<string, unknown> | null;\n    } = {},\n  ) {\n    super(message);\n    this.name = \"PayBridgeError\";\n    this.statusCode = statusCode;\n    this.type = type;\n    this.code = options.code;\n    this.requestId = options.requestId;\n    this.raw = options.raw ?? null;\n    Object.setPrototypeOf(this, new.target.prototype);\n  }\n\n  toJSON() {\n    return {\n      name: this.name,\n      message: this.message,\n      type: this.type,\n      code: this.code,\n      statusCode: this.statusCode,\n      requestId: this.requestId,\n      raw: this.raw,\n    };\n  }\n}\n\nexport class AuthenticationError extends PayBridgeError {\n  constructor(message: string, opts: ConstructorParameters<typeof PayBridgeError>[3] = {}) {\n    super(message, 401, \"authentication_error\", opts);\n    this.name = \"AuthenticationError\";\n  }\n}\n\nexport class AccountError extends PayBridgeError {\n  /** Set when `code === \"account_suspended\"`. */\n  readonly suspension: SuspensionDetail | undefined;\n  /** Set when `code === \"token_paused\"`. */\n  readonly pause: PauseDetail | undefined;\n\n  constructor(\n    message: string,\n    statusCode: number,\n    opts: ConstructorParameters<typeof PayBridgeError>[3] & {\n      suspension?: SuspensionDetail;\n      pause?: PauseDetail;\n    } = {},\n  ) {\n    super(message, statusCode, \"account_error\", opts);\n    this.name = \"AccountError\";\n    this.suspension = opts.suspension;\n    this.pause = opts.pause;\n  }\n}\n\nexport class PermissionError extends PayBridgeError {\n  constructor(message: string, statusCode = 403, opts: ConstructorParameters<typeof PayBridgeError>[3] = {}) {\n    super(message, statusCode, \"permission_error\", opts);\n    this.name = \"PermissionError\";\n  }\n}\n\nexport class InvalidRequestError extends PayBridgeError {\n  constructor(message: string, statusCode = 400, opts: ConstructorParameters<typeof PayBridgeError>[3] = {}) {\n    super(message, statusCode, \"invalid_request_error\", opts);\n    this.name = \"InvalidRequestError\";\n  }\n}\n\n/**\n * HTTP 404. A SUBCLASS of `InvalidRequestError`, so `instanceof\n * InvalidRequestError` still matches a 404 exactly as before, while\n * `instanceof NotFoundError` narrows to 404 only. The Stripe-style `type`\n * stays `invalid_request_error`.\n *\n * Added 2026-08-16 for parity with the PHP and Python SDKs, which both had a\n * NotFound class whose docs promised a working narrow catch while nothing ever\n * constructed it. `PayBridgeNotFoundError` below is the OLD alias and is left\n * pointing at `InvalidRequestError` on purpose — repointing it here would\n * narrow existing callers' catches, which would be a breaking change.\n */\nexport class NotFoundError extends InvalidRequestError {\n  constructor(message: string, opts: ConstructorParameters<typeof PayBridgeError>[3] = {}) {\n    super(message, 404, opts);\n    this.name = \"NotFoundError\";\n  }\n}\n\nexport class IdempotencyError extends PayBridgeError {\n  constructor(message: string, opts: ConstructorParameters<typeof PayBridgeError>[3] = {}) {\n    super(message, 409, \"idempotency_error\", opts);\n    this.name = \"IdempotencyError\";\n  }\n}\n\nexport class RateLimitError extends PayBridgeError {\n  /** From `Retry-After` header, in seconds. Undefined if header was absent. */\n  readonly retryAfter: number | undefined;\n\n  constructor(\n    message: string,\n    opts: ConstructorParameters<typeof PayBridgeError>[3] & { retryAfter?: number } = {},\n  ) {\n    super(message, 429, \"rate_limit_error\", opts);\n    this.name = \"RateLimitError\";\n    this.retryAfter = opts.retryAfter;\n  }\n}\n\nexport class ApiError extends PayBridgeError {\n  constructor(message: string, statusCode = 500, opts: ConstructorParameters<typeof PayBridgeError>[3] = {}) {\n    super(message, statusCode, \"api_error\", opts);\n    this.name = \"ApiError\";\n  }\n}\n\nexport class ConnectionError extends PayBridgeError {\n  constructor(message: string) {\n    super(message, 0, \"connection_error\");\n    this.name = \"ConnectionError\";\n  }\n}\n\nexport class SignatureVerificationError extends PayBridgeError {\n  constructor(message = \"Webhook signature verification failed\") {\n    super(message, 0, \"signature_verification_error\");\n    this.name = \"SignatureVerificationError\";\n  }\n}\n\n// Legacy aliases — pre-3.0 class names. Kept so the rename doesn't surprise\n// callers who imported the old names. Marked deprecated.\n/** @deprecated use `AuthenticationError` */\nexport const PayBridgeAuthenticationError = AuthenticationError;\n/** @deprecated use `InvalidRequestError` */\nexport const PayBridgeInvalidRequestError = InvalidRequestError;\n/** @deprecated use `RateLimitError` */\nexport const PayBridgeRateLimitError = RateLimitError;\n/** @deprecated use `SignatureVerificationError` */\nexport const PayBridgeSignatureVerificationError = SignatureVerificationError;\n/** @deprecated 404 is now an `InvalidRequestError` (Stripe convention) — check `statusCode === 404` if you need to distinguish */\nexport const PayBridgeNotFoundError = InvalidRequestError;\n\n/**\n * Parse an error response body and instantiate the right typed error.\n * Accepts the v3 nested envelope; tolerates the legacy flat shape so\n * old API responses don't blow up SDK consumers during migration.\n */\nexport function parseErrorResponse(\n  statusCode: number,\n  body: Record<string, unknown> | null,\n  retryAfterHeader: string | null,\n): PayBridgeError {\n  const errObj = body && typeof body === \"object\" && body.error && typeof body.error === \"object\"\n    ? (body.error as Record<string, unknown>)\n    : null;\n\n  const message = errObj\n    ? String(errObj.message ?? `HTTP ${statusCode}`)\n    : typeof body?.error === \"string\"\n      ? body.error\n      : `HTTP ${statusCode}`;\n  const type = errObj && typeof errObj.type === \"string\" ? (errObj.type as PayBridgeErrorType) : undefined;\n  const code = errObj && typeof errObj.code === \"string\"\n    ? errObj.code\n    : typeof body?.code === \"string\"\n      ? body.code\n      : undefined;\n  const requestId = errObj && typeof errObj.request_id === \"string\" ? errObj.request_id : undefined;\n  const opts = { code, requestId, raw: body };\n\n  switch (type) {\n    case \"authentication_error\":\n      return new AuthenticationError(message, opts);\n    case \"account_error\":\n      return new AccountError(message, statusCode, {\n        ...opts,\n        suspension: errObj?.suspension as SuspensionDetail | undefined,\n        pause: errObj?.pause as PauseDetail | undefined,\n      });\n    case \"permission_error\":\n      return new PermissionError(message, statusCode, opts);\n    case \"invalid_request_error\":\n      return statusCode === 404\n        ? new NotFoundError(message, opts)\n        : new InvalidRequestError(message, statusCode, opts);\n    case \"idempotency_error\":\n      return new IdempotencyError(message, opts);\n    case \"rate_limit_error\":\n      return new RateLimitError(message, {\n        ...opts,\n        retryAfter: retryAfterHeader ? Number(retryAfterHeader) : undefined,\n      });\n    case \"api_error\":\n      return new ApiError(message, statusCode, opts);\n  }\n\n  // No type field — derive from status (legacy flat shape).\n  if (statusCode === 401) return new AuthenticationError(message, opts);\n  if (statusCode === 403) return new PermissionError(message, statusCode, opts);\n  if (statusCode === 404) return new NotFoundError(message, opts);\n  if (statusCode === 409) return new InvalidRequestError(message, statusCode, opts);\n  // 429 MUST be tested before the generic 4xx branch below, which would\n  // otherwise swallow it and hand callers an InvalidRequestError they cannot\n  // back off on.\n  if (statusCode === 429) return new RateLimitError(message, {\n    ...opts,\n    retryAfter: retryAfterHeader ? Number(retryAfterHeader) : undefined,\n  });\n  if (statusCode >= 400 && statusCode < 500) return new InvalidRequestError(message, statusCode, opts);\n  return new ApiError(message, statusCode, opts);\n}\n\n/** @deprecated use `parseErrorResponse` */\nexport function createError(\n  message: string,\n  statusCode: number,\n  raw: Record<string, unknown> | null,\n): PayBridgeError {\n  // Synthesise the new envelope shape from a flat (message, statusCode, raw).\n  return parseErrorResponse(statusCode, raw, null);\n}\n","import { ConnectionError, parseErrorResponse } from \"./errors\";\nimport type { PayBridgeConfig } from \"./types\";\n\nconst DEFAULT_BASE_URL = \"https://api.paybridgenp.com\";\nconst DEFAULT_TIMEOUT = 30_000;\nconst DEFAULT_MAX_RETRIES = 2;\nconst RETRY_STATUSES = new Set([500, 502, 503, 504]);\nconst INITIAL_BACKOFF_MS = 500;\n\nfunction sleep(ms: number) {\n  return new Promise((r) => setTimeout(r, ms));\n}\n\nfunction backoff(attempt: number): number {\n  return INITIAL_BACKOFF_MS * 2 ** (attempt - 1) + Math.random() * 100;\n}\n\nexport class HttpClient {\n  private readonly baseUrl: string;\n  private readonly apiKey: string;\n  private readonly timeout: number;\n  private readonly maxRetries: number;\n\n  constructor(config: PayBridgeConfig) {\n    this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, \"\");\n    this.apiKey = config.apiKey;\n    this.timeout = config.timeout ?? DEFAULT_TIMEOUT;\n    this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;\n  }\n\n  async request<T>(method: string, path: string, body?: unknown, idempotencyKey?: string): Promise<T> {\n    const url = `${this.baseUrl}${path}`;\n    // Retrying a POST/PATCH/DELETE that may already have been applied is how a\n    // network blip becomes two checkout sessions, two subscriptions, two\n    // invoices. Every method used to be retried on a connection error and on\n    // 500/502/503/504, with no idempotency key on any attempt (external\n    // review, 2026-07-28).\n    //\n    // GET is safe by definition, so only GET auto-retries now.\n    //\n    // We also send an Idempotency-Key on unsafe requests. Replay protection is\n    // applied per route by the API, so the key is protection wherever the\n    // server offers it and it makes a caller's own retry safe there; it is\n    // NOT a licence for this client to retry writes\n    // automatically. Re-enable that only when every mutating route is wrapped.\n    const isSafe = method.toUpperCase() === \"GET\";\n    const headers: Record<string, string> = {\n      Authorization: `Bearer ${this.apiKey}`,\n      \"Content-Type\": \"application/json\",\n      \"User-Agent\": \"PayBridgeNP-SDK/5.7.0\",\n    };\n    if (!isSafe) {\n      headers[\"Idempotency-Key\"] = idempotencyKey ?? crypto.randomUUID();\n    }\n\n    let attempt = 0;\n\n    while (true) {\n      attempt++;\n\n      let res: Response;\n      try {\n        res = await fetch(url, {\n          method,\n          headers,\n          body: body !== undefined ? JSON.stringify(body) : undefined,\n          signal: AbortSignal.timeout(this.timeout),\n        });\n      } catch (err) {\n        if (!isSafe || attempt > this.maxRetries) {\n          throw new ConnectionError(`Connection error: ${(err as Error).message}`);\n        }\n        await sleep(backoff(attempt));\n        continue;\n      }\n\n      if (res.ok) {\n        return res.json() as Promise<T>;\n      }\n\n      if (isSafe && RETRY_STATUSES.has(res.status) && attempt <= this.maxRetries) {\n        const retryAfter = res.headers.get(\"Retry-After\");\n        const delay = retryAfter ? parseInt(retryAfter) * 1000 : backoff(attempt);\n        await sleep(delay);\n        continue;\n      }\n\n      let raw: Record<string, unknown> | null = null;\n      try {\n        raw = await res.json() as Record<string, unknown>;\n      } catch {\n        // Body wasn't JSON. Will surface as `HTTP <status>` with no detail.\n      }\n\n      throw parseErrorResponse(res.status, raw, res.headers.get(\"Retry-After\"));\n    }\n  }\n\n  get<T>(path: string) { return this.request<T>(\"GET\", path); }\n  post<T>(path: string, body: unknown, idempotencyKey?: string) { return this.request<T>(\"POST\", path, body, idempotencyKey); }\n  patch<T>(path: string, body: unknown, idempotencyKey?: string) { return this.request<T>(\"PATCH\", path, body, idempotencyKey); }\n  delete<T>(path: string, idempotencyKey?: string) { return this.request<T>(\"DELETE\", path, undefined, idempotencyKey); }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  CheckoutSession,\n  CreateCheckoutParams,\n  ExpiredCheckoutSession,\n  ListSessionsParams,\n  PaginatedResponse,\n  RetrievedCheckoutSession,\n} from \"../types\";\n\nexport class CheckoutResource {\n  constructor(private readonly http: HttpClient) {}\n\n  create(params: CreateCheckoutParams, idempotencyKey?: string): Promise<CheckoutSession> {\n    return this.http.post<CheckoutSession>(\"/v1/checkout\", params, idempotencyKey);\n  }\n\n  /**\n   * Retrieve a checkout session by ID, including its current status, amount,\n   * customer, and any collected address. Read-only — sessions are created via\n   * {@link create}. Hits `GET /v1/sessions/{id}`.\n   *\n   * Note: this richer read shape uses camelCase keys (`customerName`,\n   * `expiresAt`, …), unlike the snake_case create response.\n   */\n  retrieve(id: string): Promise<RetrievedCheckoutSession> {\n    return this.http.get<RetrievedCheckoutSession>(`/v1/sessions/${encodeURIComponent(id)}`);\n  }\n\n  /**\n   * List checkout sessions for the authenticated project, newest first.\n   * Optionally filter by `status` and page with `limit`/`offset`. Hits\n   * `GET /v1/sessions`.\n   */\n  list(params: ListSessionsParams = {}): Promise<PaginatedResponse<RetrievedCheckoutSession>> {\n    const qs = new URLSearchParams();\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    if (params.offset !== undefined) qs.set(\"offset\", String(params.offset));\n    if (params.status !== undefined) qs.set(\"status\", params.status);\n    const query = qs.toString();\n    return this.http.get<PaginatedResponse<RetrievedCheckoutSession>>(\n      `/v1/sessions${query ? `?${query}` : \"\"}`,\n    );\n  }\n\n  /**\n   * Expire a checkout session so it can no longer accept payment.\n   *\n   * Use this when you mint a fresh checkout session for a logical purchase\n   * that already had one outstanding (a customer requesting a new payment\n   * link, your reminder system regenerating expired URLs, etc.). Without\n   * explicitly expiring the old session, its URL remains payable until the\n   * 30-minute TTL elapses, which can let a customer who reloads the old tab\n   * pay twice. Mirrors Stripe's `POST /checkout/sessions/{id}/expire`.\n   *\n   * Idempotent: calling on an already-terminal session is a no-op that\n   * returns the current row state without error.\n   */\n  expire(id: string, idempotencyKey?: string): Promise<ExpiredCheckoutSession> {\n    return this.http.post<ExpiredCheckoutSession>(\n      `/v1/checkout/${encodeURIComponent(id)}/expire`,\n      {},\n      idempotencyKey,\n    );\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  CreatePaymentLinkParams,\n  DeletedPaymentLink,\n  ListPaymentLinksParams,\n  PaginatedResponse,\n  PaymentLink,\n  PaymentLinkWithStats,\n  UpdatePaymentLinkParams,\n} from \"../types\";\n\n/**\n * Reusable hosted payment pages. Mirrors the public `/v1/payment-links` routes\n * (all require an API key with the `links:read` / `links:write` scope).\n */\nexport class PaymentLinksResource {\n  constructor(private readonly http: HttpClient) {}\n\n  /** Create a payment link. Returns the created link (HTTP 201). */\n  create(params: CreatePaymentLinkParams, idempotencyKey?: string): Promise<PaymentLink> {\n    return this.http.post<PaymentLink>(\"/v1/payment-links\", params, idempotencyKey);\n  }\n\n  /** List payment links for the project, newest first. Filter with `active`. */\n  list(params: ListPaymentLinksParams = {}): Promise<PaginatedResponse<PaymentLink>> {\n    const qs = new URLSearchParams();\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    if (params.offset !== undefined) qs.set(\"offset\", String(params.offset));\n    if (params.active !== undefined) qs.set(\"active\", String(params.active));\n    const query = qs.toString();\n    return this.http.get<PaginatedResponse<PaymentLink>>(\n      `/v1/payment-links${query ? `?${query}` : \"\"}`,\n    );\n  }\n\n  /** Retrieve a single link by ID, including aggregated view/conversion stats. */\n  retrieve(id: string): Promise<PaymentLinkWithStats> {\n    return this.http.get<PaymentLinkWithStats>(`/v1/payment-links/${encodeURIComponent(id)}`);\n  }\n\n  /** Update a link's editable fields. Only the keys you pass are changed. */\n  update(id: string, params: UpdatePaymentLinkParams, idempotencyKey?: string): Promise<PaymentLink> {\n    return this.http.patch<PaymentLink>(`/v1/payment-links/${encodeURIComponent(id)}`, params, idempotencyKey);\n  }\n\n  /**\n   * Cancel (deactivate) a link so it can no longer accept payments, while\n   * keeping it and its history for your records. The recommended way to retire\n   * a link that has already been used.\n   */\n  cancel(id: string, idempotencyKey?: string): Promise<PaymentLink> {\n    return this.http.post<PaymentLink>(`/v1/payment-links/${encodeURIComponent(id)}/cancel`, {}, idempotencyKey);\n  }\n\n  /**\n   * Permanently delete a link. Only allowed when the link has never been used —\n   * otherwise the API returns 422 and you should {@link cancel} it instead.\n   */\n  delete(id: string, idempotencyKey?: string): Promise<DeletedPaymentLink> {\n    return this.http.delete<DeletedPaymentLink>(`/v1/payment-links/${encodeURIComponent(id)}`, idempotencyKey);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type { Payment, ListPaymentsParams, PaginatedResponse } from \"../types\";\n\nexport class PaymentsResource {\n  constructor(private readonly http: HttpClient) {}\n\n  list(params: ListPaymentsParams = {}): Promise<PaginatedResponse<Payment>> {\n    const qs = new URLSearchParams();\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    if (params.offset !== undefined) qs.set(\"offset\", String(params.offset));\n    const query = qs.toString();\n    return this.http.get<PaginatedResponse<Payment>>(`/v1/payments${query ? `?${query}` : \"\"}`);\n  }\n\n  retrieve(id: string): Promise<Payment> {\n    return this.http.get<Payment>(`/v1/payments/${id}`);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type { Refund, CreateRefundParams, ListRefundsParams } from \"../types/refunds\";\nimport type { PaginatedResponse } from \"../types\";\n\nexport class RefundsResource {\n  constructor(private readonly http: HttpClient) {}\n\n  create(params: CreateRefundParams, idempotencyKey?: string): Promise<Refund> {\n    return this.http.post<Refund>(\"/v1/refunds\", params, idempotencyKey);\n  }\n\n  list(params: ListRefundsParams = {}): Promise<PaginatedResponse<Refund>> {\n    const qs = new URLSearchParams();\n    if (params.paymentId !== undefined) qs.set(\"paymentId\", params.paymentId);\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    if (params.offset !== undefined) qs.set(\"offset\", String(params.offset));\n    const query = qs.toString();\n    return this.http.get<PaginatedResponse<Refund>>(`/v1/refunds${query ? `?${query}` : \"\"}`);\n  }\n\n  retrieve(id: string): Promise<Refund> {\n    return this.http.get<Refund>(`/v1/refunds/${id}`);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  CreateWebhookParams,\n  UpdateWebhookParams,\n  WebhookDelivery,\n  WebhookEndpoint,\n  WebhookEvent,\n} from \"../types\";\nimport { PayBridgeSignatureVerificationError } from \"../errors\";\n\nexport class WebhooksResource {\n  constructor(private readonly http?: HttpClient) {}\n\n  create(params: CreateWebhookParams, idempotencyKey?: string): Promise<WebhookEndpoint & { signing_secret: string }> {\n    if (!this.http) throw new Error(\"WebhooksResource requires an HttpClient\");\n    return this.http.post<WebhookEndpoint & { signing_secret: string }>(\"/v1/webhooks\", params, idempotencyKey);\n  }\n\n  list(): Promise<{ data: WebhookEndpoint[] }> {\n    if (!this.http) throw new Error(\"WebhooksResource requires an HttpClient\");\n    return this.http.get<{ data: WebhookEndpoint[] }>(\"/v1/webhooks\");\n  }\n\n  update(id: string, params: UpdateWebhookParams, idempotencyKey?: string): Promise<WebhookEndpoint> {\n    if (!this.http) throw new Error(\"WebhooksResource requires an HttpClient\");\n    return this.http.patch<WebhookEndpoint>(`/v1/webhooks/${id}`, params, idempotencyKey);\n  }\n\n  delete(id: string, idempotencyKey?: string): Promise<{ deleted: boolean; id: string }> {\n    if (!this.http) throw new Error(\"WebhooksResource requires an HttpClient\");\n    return this.http.delete<{ deleted: boolean; id: string }>(`/v1/webhooks/${id}`, idempotencyKey);\n  }\n\n  listDeliveries(id: string): Promise<{ data: WebhookDelivery[] }> {\n    if (!this.http) throw new Error(\"WebhooksResource requires an HttpClient\");\n    return this.http.get<{ data: WebhookDelivery[] }>(`/v1/webhooks/${id}/deliveries`);\n  }\n\n  /**\n   * Verify and parse a webhook event from an incoming request.\n   *\n   * @param body      - Raw request body string (do NOT parse as JSON first)\n   * @param signature - Value of the `X-PayBridgeNP-Signature` header\n   * @param secret    - Your webhook signing secret (whsec_...)\n   */\n  async constructEvent<T = unknown>(\n    body: string,\n    signature: string | null,\n    secret: string,\n  ): Promise<WebhookEvent<T>> {\n    if (!signature) throw new PayBridgeSignatureVerificationError(\"Missing X-PayBridgeNP-Signature header\");\n\n    const parts = Object.fromEntries(\n      signature.split(\",\").map((p) => p.split(\"=\") as [string, string]),\n    );\n\n    const timestamp = parts[\"t\"];\n    const v1 = parts[\"v1\"];\n\n    if (!timestamp || !v1) {\n      throw new PayBridgeSignatureVerificationError(\"Malformed signature header\");\n    }\n\n    // Replay attack protection: reject if timestamp is >5 minutes old\n    const ts = parseInt(timestamp);\n    const now = Math.floor(Date.now() / 1000);\n    if (Math.abs(now - ts) > 300) {\n      throw new PayBridgeSignatureVerificationError(\"Timestamp too old — possible replay attack\");\n    }\n\n    // Compute expected HMAC\n    const { createHmac, timingSafeEqual } = await import(\"crypto\");\n    const expected = createHmac(\"sha256\", secret)\n      .update(`${timestamp}.${body}`)\n      .digest(\"hex\");\n\n    const signatureBuffer = Buffer.from(v1, \"hex\");\n    const expectedBuffer = Buffer.from(expected, \"hex\");\n\n    if (\n      signatureBuffer.length !== expectedBuffer.length ||\n      !timingSafeEqual(signatureBuffer, expectedBuffer)\n    ) {\n      throw new PayBridgeSignatureVerificationError();\n    }\n\n    return JSON.parse(body) as WebhookEvent<T>;\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  CreatePlanParams,\n  UpdatePlanParams,\n  ListPlansParams,\n  Plan,\n  PaginatedBillingResponse,\n} from \"../types/billing\";\n\nexport class PlansResource {\n  constructor(private readonly http: HttpClient) {}\n\n  create(params: CreatePlanParams, idempotencyKey?: string): Promise<Plan> {\n    return this.http.post<Plan>(\"/v1/billing/plans\", params, idempotencyKey);\n  }\n\n  list(params: ListPlansParams = {}): Promise<PaginatedBillingResponse<Plan>> {\n    const qs = new URLSearchParams();\n    if (params.page !== undefined) qs.set(\"page\", String(params.page));\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    if (params.active !== undefined) qs.set(\"active\", String(params.active));\n    const query = qs.toString();\n    return this.http.get<PaginatedBillingResponse<Plan>>(`/v1/billing/plans${query ? `?${query}` : \"\"}`);\n  }\n\n  get(id: string): Promise<Plan> {\n    return this.http.get<Plan>(`/v1/billing/plans/${id}`);\n  }\n\n  update(id: string, params: UpdatePlanParams, idempotencyKey?: string): Promise<Plan> {\n    return this.http.patch<Plan>(`/v1/billing/plans/${id}`, params, idempotencyKey);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  CreateCustomerParams,\n  UpdateCustomerParams,\n  ListCustomersParams,\n  BillingCustomer,\n  PaginatedBillingResponse,\n} from \"../types/billing\";\n\nexport type AddCreditParams = {\n  /** Amount in paisa (NPR × 100). Use negative to deduct. */\n  amount: number;\n  note?: string | null;\n};\n\nexport class CustomersResource {\n  constructor(private readonly http: HttpClient) {}\n\n  create(params: CreateCustomerParams, idempotencyKey?: string): Promise<BillingCustomer> {\n    return this.http.post<BillingCustomer>(\"/v1/billing/customers\", params, idempotencyKey);\n  }\n\n  list(params: ListCustomersParams = {}): Promise<PaginatedBillingResponse<BillingCustomer>> {\n    const qs = new URLSearchParams();\n    if (params.page !== undefined) qs.set(\"page\", String(params.page));\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    if (params.search !== undefined) qs.set(\"search\", params.search);\n    const query = qs.toString();\n    return this.http.get<PaginatedBillingResponse<BillingCustomer>>(\n      `/v1/billing/customers${query ? `?${query}` : \"\"}`,\n    );\n  }\n\n  get(id: string): Promise<BillingCustomer> {\n    return this.http.get<BillingCustomer>(`/v1/billing/customers/${id}`);\n  }\n\n  update(id: string, params: UpdateCustomerParams, idempotencyKey?: string): Promise<BillingCustomer> {\n    return this.http.patch<BillingCustomer>(`/v1/billing/customers/${id}`, params, idempotencyKey);\n  }\n\n  delete(id: string, idempotencyKey?: string): Promise<{ deleted: boolean }> {\n    return this.http.delete<{ deleted: boolean }>(`/v1/billing/customers/${id}`, idempotencyKey);\n  }\n\n  /**\n   * Add (or deduct, with negative amount) credits to a customer's balance.\n   * Credits are applied automatically against future invoices before payment.\n   * @param amount Amount in paisa (NPR × 100).\n   */\n  addCredit(id: string, params: AddCreditParams, idempotencyKey?: string): Promise<BillingCustomer> {\n    return this.http.post<BillingCustomer>(`/v1/billing/customers/${id}/credit`, params, idempotencyKey);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  ApplyCouponParams,\n  BillingListResponse,\n  CancelSubscriptionParams,\n  ChangePlanParams,\n  ChangePlanResult,\n  CreateInvoiceItemParams,\n  CreateSubscriptionParams,\n  Discount,\n  EndTrialResponse,\n  ExtendTrialParams,\n  InvoiceItem,\n  ListSubscriptionsParams,\n  PaginatedBillingResponse,\n  PauseSubscriptionParams,\n  ProrationPreview,\n  ReportUsageParams,\n  Subscription,\n  UsageRecord,\n  UsageReportAck,\n  UsageSummary,\n} from \"../types/billing\";\n\nexport class SubscriptionsResource {\n  constructor(private readonly http: HttpClient) {}\n\n  create(params: CreateSubscriptionParams, idempotencyKey?: string): Promise<Subscription> {\n    return this.http.post<Subscription>(\"/v1/billing/subscriptions\", params, idempotencyKey);\n  }\n\n  list(params: ListSubscriptionsParams = {}): Promise<PaginatedBillingResponse<Subscription>> {\n    const qs = new URLSearchParams();\n    if (params.page !== undefined) qs.set(\"page\", String(params.page));\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    if (params.status !== undefined) qs.set(\"status\", params.status);\n    if (params.customerId !== undefined) qs.set(\"customerId\", params.customerId);\n    if (params.planId !== undefined) qs.set(\"planId\", params.planId);\n    const query = qs.toString();\n    return this.http.get<PaginatedBillingResponse<Subscription>>(\n      `/v1/billing/subscriptions${query ? `?${query}` : \"\"}`,\n    );\n  }\n\n  get(id: string): Promise<Subscription> {\n    return this.http.get<Subscription>(`/v1/billing/subscriptions/${id}`);\n  }\n\n  pause(id: string, params: PauseSubscriptionParams = {}, idempotencyKey?: string): Promise<Subscription> {\n    return this.http.post<Subscription>(`/v1/billing/subscriptions/${id}/pause`, params, idempotencyKey);\n  }\n\n  resume(id: string, idempotencyKey?: string): Promise<Subscription> {\n    return this.http.post<Subscription>(`/v1/billing/subscriptions/${id}/resume`, {}, idempotencyKey);\n  }\n\n  cancel(id: string, params: CancelSubscriptionParams = {}, idempotencyKey?: string): Promise<Subscription> {\n    return this.http.post<Subscription>(`/v1/billing/subscriptions/${id}/cancel`, params, idempotencyKey);\n  }\n\n  changePlan(id: string, params: ChangePlanParams, idempotencyKey?: string): Promise<ChangePlanResult> {\n    return this.http.post<ChangePlanResult>(`/v1/billing/subscriptions/${id}/change-plan`, params, idempotencyKey);\n  }\n\n  /**\n   * Preview the proration credit/debit amounts for a mid-period plan change\n   * without committing any changes. Use before calling `changePlan` with\n   * `prorationBehavior: \"create_prorations\"` to show the customer the net amount.\n   */\n  previewProration(id: string, newPlanId: string): Promise<ProrationPreview> {\n    return this.http.get<ProrationPreview>(\n      `/v1/billing/subscriptions/${id}/preview-proration?newPlanId=${encodeURIComponent(newPlanId)}`,\n    );\n  }\n\n  /**\n   * End a subscription's trial immediately. Generates the first paid invoice\n   * and emails it to the customer. Fires `subscription.trial_ended` webhook.\n   * Idempotent — subsequent calls return 409 `trial_not_active`.\n   */\n  endTrial(id: string, idempotencyKey?: string): Promise<EndTrialResponse> {\n    return this.http.post<EndTrialResponse>(`/v1/billing/subscriptions/${id}/end-trial`, {}, idempotencyKey);\n  }\n\n  /**\n   * Push the trial end date further into the future. Only valid while trial\n   * is still active. Re-arms the 3-day-before reminder. Fires\n   * `subscription.trial_extended` webhook.\n   */\n  extendTrial(id: string, params: ExtendTrialParams, idempotencyKey?: string): Promise<Subscription> {\n    return this.http.post<Subscription>(`/v1/billing/subscriptions/${id}/extend-trial`, params, idempotencyKey);\n  }\n\n  /**\n   * Attach a coupon or promotion code to an existing subscription. Takes\n   * effect on the next invoice. Deactivates any prior active discount on\n   * this sub (partial unique index enforces one active discount per sub).\n   */\n  applyCoupon(id: string, params: ApplyCouponParams, idempotencyKey?: string): Promise<Discount> {\n    return this.http.post<Discount>(`/v1/billing/subscriptions/${id}/apply-coupon`, params, idempotencyKey);\n  }\n\n  /** Remove the currently active discount. Future invoices are un-discounted. */\n  removeDiscount(id: string, idempotencyKey?: string): Promise<Discount> {\n    return this.http.delete<Discount>(`/v1/billing/subscriptions/${id}/discount`, idempotencyKey);\n  }\n\n  // ── Usage (metered billing) ─────────────────────────────────────────────────\n\n  /**\n   * Report a usage event for a metered subscription. Use `action: \"increment\"`\n   * (default) to add to the running total, or `action: \"set\"` for gauge-style\n   * metrics. Pass `idempotencyKey` to prevent double-counting.\n   */\n  reportUsage(id: string, params: ReportUsageParams, idempotencyKey?: string): Promise<UsageReportAck> {\n    return this.http.post<UsageReportAck>(`/v1/billing/subscriptions/${id}/usage`, {\n      quantity: params.quantity,\n      action: params.action,\n      recorded_at: params.recordedAt,\n      idempotency_key: params.idempotencyKey,\n    }, idempotencyKey);\n  }\n\n  /** Get the aggregated usage summary for the current billing period. */\n  getUsageSummary(id: string): Promise<UsageSummary> {\n    return this.http.get<UsageSummary>(`/v1/billing/subscriptions/${id}/usage`);\n  }\n\n  /** List raw usage records for a subscription. */\n  listUsageRecords(id: string, limit?: number): Promise<BillingListResponse<UsageRecord>> {\n    const qs = limit ? `?limit=${limit}` : \"\";\n    return this.http.get<BillingListResponse<UsageRecord>>(`/v1/billing/subscriptions/${id}/usage/records${qs}`);\n  }\n\n  // ── Pending Invoice Items ───────────────────────────────────────────────────\n\n  /** List pending one-off charges that will be included in the next invoice. */\n  listInvoiceItems(id: string): Promise<BillingListResponse<InvoiceItem>> {\n    return this.http.get<BillingListResponse<InvoiceItem>>(`/v1/billing/subscriptions/${id}/invoice-items`);\n  }\n\n  /**\n   * Add a one-off charge to a subscription. It will be included (and consumed)\n   * when the next invoice is generated.\n   */\n  createInvoiceItem(id: string, params: CreateInvoiceItemParams, idempotencyKey?: string): Promise<InvoiceItem> {\n    return this.http.post<InvoiceItem>(`/v1/billing/subscriptions/${id}/invoice-items`, params, idempotencyKey);\n  }\n\n  /** Delete a pending invoice item before it is invoiced. */\n  deleteInvoiceItem(subscriptionId: string, itemId: string, idempotencyKey?: string): Promise<{ deleted: boolean }> {\n    return this.http.delete<{ deleted: boolean }>(`/v1/billing/subscriptions/${subscriptionId}/invoice-items/${itemId}`, idempotencyKey);\n  }\n\n  /** Update the per-seat quantity on an active per_unit subscription. */\n  updateQuantity(id: string, quantity: number, idempotencyKey?: string): Promise<Subscription> {\n    return this.http.patch<Subscription>(`/v1/billing/subscriptions/${id}/quantity`, { quantity }, idempotencyKey);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  ListInvoicesParams,\n  Invoice,\n  PaginatedBillingResponse,\n} from \"../types/billing\";\nimport type { FonepayQrSession } from \"../types/qr\";\n\nexport class InvoicesResource {\n  constructor(private readonly http: HttpClient) {}\n\n  list(params: ListInvoicesParams = {}): Promise<PaginatedBillingResponse<Invoice>> {\n    const qs = new URLSearchParams();\n    if (params.page !== undefined) qs.set(\"page\", String(params.page));\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    if (params.status !== undefined) qs.set(\"status\", params.status);\n    if (params.customerId !== undefined) qs.set(\"customerId\", params.customerId);\n    if (params.subscriptionId !== undefined) qs.set(\"subscriptionId\", params.subscriptionId);\n    if (params.search !== undefined) qs.set(\"search\", params.search);\n    const query = qs.toString();\n    return this.http.get<PaginatedBillingResponse<Invoice>>(\n      `/v1/billing/invoices${query ? `?${query}` : \"\"}`,\n    );\n  }\n\n  get(id: string): Promise<Invoice> {\n    return this.http.get<Invoice>(`/v1/billing/invoices/${id}`);\n  }\n\n  /**\n   * Mint a Fonepay Direct-QR to pay this invoice. The customer scans it (in your\n   * own UI / at a counter) and on success the invoice is marked paid and the\n   * subscription activates (`incomplete`→`active`) — the same outcome as the\n   * hosted bill page, just collected via an embedded QR. Returns a normal\n   * Direct-QR session (use its `events_url` SSE stream + `qr.refresh(id)`).\n   *\n   * Premium feature; requires the `billing:write` scope and Fonepay configured.\n   */\n  qr(id: string, idempotencyKey?: string): Promise<FonepayQrSession> {\n    return this.http.post<FonepayQrSession>(`/v1/billing/invoices/${encodeURIComponent(id)}/qr`, {}, idempotencyKey);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  CreateCouponParams,\n  Coupon,\n  ListCouponsParams,\n  BillingListResponse,\n} from \"../types/billing\";\n\nexport class CouponsResource {\n  constructor(private readonly http: HttpClient) {}\n\n  /**\n   * Create a reusable coupon. Discount params are immutable post-creation —\n   * replace by deactivating and creating a new one.\n   */\n  create(params: CreateCouponParams, idempotencyKey?: string): Promise<Coupon> {\n    return this.http.post<Coupon>(\"/v1/billing/coupons\", params, idempotencyKey);\n  }\n\n  list(params: ListCouponsParams = {}): Promise<BillingListResponse<Coupon>> {\n    const qs = new URLSearchParams();\n    if (params.active !== undefined) qs.set(\"active\", String(params.active));\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    const query = qs.toString();\n    return this.http.get<BillingListResponse<Coupon>>(\n      `/v1/billing/coupons${query ? `?${query}` : \"\"}`,\n    );\n  }\n\n  get(id: string): Promise<Coupon> {\n    return this.http.get<Coupon>(`/v1/billing/coupons/${id}`);\n  }\n\n  /** Deactivate. Soft-delete — historical redemptions remain intact. */\n  deactivate(id: string, idempotencyKey?: string): Promise<Coupon> {\n    return this.http.delete<Coupon>(`/v1/billing/coupons/${id}`, idempotencyKey);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  CreatePromotionCodeParams,\n  PromotionCode,\n  ListPromotionCodesParams,\n  ValidatePromotionCodeParams,\n  ValidatePromotionCodeResponse,\n  BillingListResponse,\n} from \"../types/billing\";\n\nexport class PromotionCodesResource {\n  constructor(private readonly http: HttpClient) {}\n\n  /**\n   * Create a customer-facing promotion code that redeems a coupon. Code is\n   * auto-uppercased server-side and unique per merchant.\n   */\n  create(params: CreatePromotionCodeParams, idempotencyKey?: string): Promise<PromotionCode> {\n    return this.http.post<PromotionCode>(\"/v1/billing/promotion-codes\", params, idempotencyKey);\n  }\n\n  list(params: ListPromotionCodesParams = {}): Promise<BillingListResponse<PromotionCode>> {\n    const qs = new URLSearchParams();\n    if (params.couponId) qs.set(\"couponId\", params.couponId);\n    if (params.active !== undefined) qs.set(\"active\", String(params.active));\n    if (params.limit !== undefined) qs.set(\"limit\", String(params.limit));\n    const query = qs.toString();\n    return this.http.get<BillingListResponse<PromotionCode>>(\n      `/v1/billing/promotion-codes${query ? `?${query}` : \"\"}`,\n    );\n  }\n\n  get(id: string): Promise<PromotionCode> {\n    return this.http.get<PromotionCode>(`/v1/billing/promotion-codes/${id}`);\n  }\n\n  /** Deactivate. Existing redemptions remain valid. */\n  deactivate(id: string, idempotencyKey?: string): Promise<PromotionCode> {\n    return this.http.patch<PromotionCode>(`/v1/billing/promotion-codes/${id}`, { active: false }, idempotencyKey);\n  }\n\n  /**\n   * Read-only validation with discount preview. Safe to poll. Does NOT\n   * redeem the code.\n   */\n  validate(params: ValidatePromotionCodeParams, idempotencyKey?: string): Promise<ValidatePromotionCodeResponse> {\n    return this.http.post<ValidatePromotionCodeResponse>(\n      \"/v1/billing/promotion-codes/validate\",\n      params,\n      idempotencyKey,\n    );\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n  CreateDunningPolicyParams,\n  DunningAttempt,\n  DunningFinalAction,\n  DunningInvoiceStatus,\n  DunningPolicy,\n  UpdateDunningPolicyParams,\n} from \"../types/billing\";\n\nexport class DunningResource {\n  constructor(private readonly http: HttpClient) {}\n\n  // ── Policies ───────────────────────────────────────────────────────────────\n\n  createPolicy(params: CreateDunningPolicyParams, idempotencyKey?: string): Promise<DunningPolicy> {\n    return this.http.post<DunningPolicy>(\"/v1/billing/dunning/policies\", params, idempotencyKey);\n  }\n\n  listPolicies(): Promise<{ data: DunningPolicy[] }> {\n    return this.http.get<{ data: DunningPolicy[] }>(\"/v1/billing/dunning/policies\");\n  }\n\n  getPolicy(id: string): Promise<DunningPolicy> {\n    return this.http.get<DunningPolicy>(`/v1/billing/dunning/policies/${id}`);\n  }\n\n  updatePolicy(id: string, params: UpdateDunningPolicyParams, idempotencyKey?: string): Promise<DunningPolicy> {\n    return this.http.patch<DunningPolicy>(`/v1/billing/dunning/policies/${id}`, params, idempotencyKey);\n  }\n\n  // ── Subscription policy assignment ────────────────────────────────────────\n\n  setSubscriptionPolicy(subscriptionId: string, policyId: string | null, idempotencyKey?: string): Promise<{ ok: boolean }> {\n    return this.http.post<{ ok: boolean }>(\n      `/v1/billing/dunning/subscriptions/${subscriptionId}/policy`,\n      { policyId },\n      idempotencyKey,\n    );\n  }\n\n  // ── Invoice dunning actions ────────────────────────────────────────────────\n\n  getInvoiceStatus(invoiceId: string): Promise<DunningInvoiceStatus> {\n    return this.http.get<DunningInvoiceStatus>(\n      `/v1/billing/dunning/invoices/${invoiceId}/dunning`,\n    );\n  }\n\n  stopInvoice(invoiceId: string, idempotencyKey?: string): Promise<{ ok: boolean }> {\n    return this.http.post<{ ok: boolean }>(\n      `/v1/billing/dunning/invoices/${invoiceId}/dunning/stop`,\n      {},\n      idempotencyKey,\n    );\n  }\n\n  retryInvoiceNow(invoiceId: string, idempotencyKey?: string): Promise<{ ok: boolean }> {\n    return this.http.post<{ ok: boolean }>(\n      `/v1/billing/dunning/invoices/${invoiceId}/dunning/retry-now`,\n      {},\n      idempotencyKey,\n    );\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type { TaxSettings, UpdateTaxSettingsParams } from \"../types/billing\";\n\n/** Account-level tax configuration applied to invoices. */\nexport class TaxResource {\n  constructor(private readonly http: HttpClient) {}\n\n  /** Get the current tax settings. */\n  getSettings(): Promise<TaxSettings> {\n    return this.http.get<TaxSettings>(\"/v1/billing/settings/tax\");\n  }\n\n  /** Update tax settings (enabled, rate, registration number, label). */\n  updateSettings(params: UpdateTaxSettingsParams, idempotencyKey?: string): Promise<TaxSettings> {\n    return this.http.patch<TaxSettings>(\"/v1/billing/settings/tax\", params, idempotencyKey);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type { CreateFonepayQrParams, FonepayQrSession } from \"../types/qr\";\n\nexport class QrResource {\n  constructor(private readonly http: HttpClient) {}\n\n  /**\n   * Create a Fonepay Direct-QR session. Returns the raw QR string, a base64\n   * PNG image, and a per-session SSE URL for real-time payment events.\n   *\n   * Premium feature — requires the merchant to be on the Premium plan.\n   */\n  fonepay(params: CreateFonepayQrParams, idempotencyKey?: string): Promise<FonepayQrSession> {\n    return this.http.post<FonepayQrSession>(\"/v1/qr/fonepay\", params, idempotencyKey);\n  }\n\n  /**\n   * Refresh a Direct-QR session: regenerate a fresh Fonepay QR for the SAME\n   * session (same `id`, `events_url`, and webhook) without spawning a new\n   * session. The Fonepay QR display window is only ~3 minutes, so call this\n   * when `qr.expired` fires (or proactively) to keep a scannable QR on screen.\n   * Takes no body — the amount and customer already live on the session. The\n   * session's overall lifetime is unchanged.\n   *\n   * Premium feature — requires the merchant to be on the Premium plan.\n   */\n  refresh(id: string, idempotencyKey?: string): Promise<FonepayQrSession> {\n    return this.http.post<FonepayQrSession>(`/v1/qr/${encodeURIComponent(id)}/refresh`, {}, idempotencyKey);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type { Account } from \"../types\";\n\n/** Account context implied by the calling API key. */\nexport class AccountResource {\n  constructor(private readonly http: HttpClient) {}\n\n  get(): Promise<Account> {\n    return this.http.get<Account>(\"/v1/account\");\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type { AnalyticsOverview } from \"../types\";\n\n/** Aggregated payment and checkout KPIs. */\nexport class AnalyticsResource {\n  constructor(private readonly http: HttpClient) {}\n\n  overview(days?: number): Promise<AnalyticsOverview> {\n    const query = days === undefined ? \"\" : `?days=${encodeURIComponent(String(days))}`;\n    return this.http.get<AnalyticsOverview>(`/v1/analytics/overview${query}`);\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type { ProviderList } from \"../types\";\n\n/** Providers enabled and configured for the authenticated project. */\nexport class ProvidersResource {\n  constructor(private readonly http: HttpClient) {}\n\n  list(): Promise<ProviderList> {\n    return this.http.get<ProviderList>(\"/v1/providers\");\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type { NotifyPendingPaymentParams, SmsNotifyResult } from \"../types\";\n\n/** Transactional SMS operations. */\nexport class SmsResource {\n  constructor(private readonly http: HttpClient) {}\n\n  /**\n   * Send a pending-payment reminder. The optional key is sent for SDK API\n   * consistency, but the server does not currently deduplicate this route.\n   */\n  notifyPendingPayment(params: NotifyPendingPaymentParams, idempotencyKey?: string): Promise<SmsNotifyResult> {\n    return this.http.post<SmsNotifyResult>(\"/v1/sms/notify-pending-payment\", params, idempotencyKey);\n  }\n}\n","import { HttpClient } from \"./http\";\nimport { CheckoutResource } from \"./resources/checkout\";\nimport { PaymentLinksResource } from \"./resources/paymentLinks\";\nimport { PaymentsResource } from \"./resources/payments\";\nimport { RefundsResource } from \"./resources/refunds\";\nimport { WebhooksResource } from \"./resources/webhooks\";\nimport { PlansResource } from \"./resources/plans\";\nimport { CustomersResource } from \"./resources/customers\";\nimport { SubscriptionsResource } from \"./resources/subscriptions\";\nimport { InvoicesResource } from \"./resources/invoices\";\nimport { CouponsResource } from \"./resources/coupons\";\nimport { PromotionCodesResource } from \"./resources/promotionCodes\";\nimport { DunningResource } from \"./resources/dunning\";\nimport { TaxResource } from \"./resources/tax\";\nimport { QrResource } from \"./resources/qr\";\nimport { AccountResource } from \"./resources/account\";\nimport { AnalyticsResource } from \"./resources/analytics\";\nimport { ProvidersResource } from \"./resources/providers\";\nimport { SmsResource } from \"./resources/sms\";\nimport type { PayBridgeConfig } from \"./types\";\n\nexport class PayBridgeNP {\n  private readonly http: HttpClient;\n\n  /** Static webhook utility — no instance required for signature verification. */\n  static readonly webhooks = new WebhooksResource();\n\n  private _checkout?: CheckoutResource;\n  private _paymentLinks?: PaymentLinksResource;\n  private _payments?: PaymentsResource;\n  private _refunds?: RefundsResource;\n  private _webhooks?: WebhooksResource;\n  private _plans?: PlansResource;\n  private _customers?: CustomersResource;\n  private _subscriptions?: SubscriptionsResource;\n  private _invoices?: InvoicesResource;\n  private _coupons?: CouponsResource;\n  private _promotionCodes?: PromotionCodesResource;\n  private _dunning?: DunningResource;\n  private _tax?: TaxResource;\n  private _qr?: QrResource;\n  private _account?: AccountResource;\n  private _analytics?: AnalyticsResource;\n  private _providers?: ProvidersResource;\n  private _sms?: SmsResource;\n\n  constructor(config: PayBridgeConfig) {\n    this.http = new HttpClient(config);\n  }\n\n  get checkout(): CheckoutResource {\n    return (this._checkout ??= new CheckoutResource(this.http));\n  }\n\n  /** Reusable hosted payment pages — create / list / retrieve / update / cancel / delete. */\n  get paymentLinks(): PaymentLinksResource {\n    return (this._paymentLinks ??= new PaymentLinksResource(this.http));\n  }\n\n  get payments(): PaymentsResource {\n    return (this._payments ??= new PaymentsResource(this.http));\n  }\n\n  get refunds(): RefundsResource {\n    return (this._refunds ??= new RefundsResource(this.http));\n  }\n\n  get webhooks(): WebhooksResource {\n    return (this._webhooks ??= new WebhooksResource(this.http));\n  }\n\n  get plans(): PlansResource {\n    return (this._plans ??= new PlansResource(this.http));\n  }\n\n  get customers(): CustomersResource {\n    return (this._customers ??= new CustomersResource(this.http));\n  }\n\n  get subscriptions(): SubscriptionsResource {\n    return (this._subscriptions ??= new SubscriptionsResource(this.http));\n  }\n\n  get invoices(): InvoicesResource {\n    return (this._invoices ??= new InvoicesResource(this.http));\n  }\n\n  get coupons(): CouponsResource {\n    return (this._coupons ??= new CouponsResource(this.http));\n  }\n\n  get promotionCodes(): PromotionCodesResource {\n    return (this._promotionCodes ??= new PromotionCodesResource(this.http));\n  }\n\n  get dunning(): DunningResource {\n    return (this._dunning ??= new DunningResource(this.http));\n  }\n\n  /** Account-level tax settings applied to invoices. */\n  get tax(): TaxResource {\n    return (this._tax ??= new TaxResource(this.http));\n  }\n\n  /**\n   * Direct-QR API for Fonepay. Premium feature — generates an embeddable QR\n   * + SSE event stream so developers can build their own checkout UI.\n   */\n  get qr(): QrResource {\n    return (this._qr ??= new QrResource(this.http));\n  }\n\n  /** Account context implied by the calling API key. */\n  get account(): AccountResource { return (this._account ??= new AccountResource(this.http)); }\n\n  /** Aggregated payment and checkout KPIs. */\n  get analytics(): AnalyticsResource { return (this._analytics ??= new AnalyticsResource(this.http)); }\n\n  /** Providers enabled and configured for this project. */\n  get providers(): ProvidersResource { return (this._providers ??= new ProvidersResource(this.http)); }\n\n  /** Transactional SMS operations. */\n  get sms(): SmsResource { return (this._sms ??= new SmsResource(this.http)); }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACkCO,IAAM,iBAAN,cAA6B,MAAM;AAAA;AAAA,EAE/B;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAET,YACE,SACA,YACA,MACA,UAII,CAAC,GACL;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ;AACpB,SAAK,YAAY,QAAQ;AACzB,SAAK,MAAM,QAAQ,OAAO;AAC1B,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,YAAY,KAAK;AAAA,MACjB,WAAW,KAAK;AAAA,MAChB,KAAK,KAAK;AAAA,IACZ;AAAA,EACF;AACF;AAEO,IAAM,sBAAN,cAAkC,eAAe;AAAA,EACtD,YAAY,SAAiB,OAAwD,CAAC,GAAG;AACvF,UAAM,SAAS,KAAK,wBAAwB,IAAI;AAChD,SAAK,OAAO;A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