From 681cfd1c37e48ea311e374ad75c6a52defc01ca5 Mon Sep 17 00:00:00 2001 From: Jaafar Date: Thu, 6 Aug 2026 13:08:15 +0300 Subject: [PATCH] feat: add optional iframe init option to invoices.create Adds an optional `iframe` field to CreateInvoiceParams, mirroring the existing unsigned `paymentMode` passthrough. It is sent in the request body (as a Laravel-boolean-truthy "1") but excluded from the HMAC signature. Set `iframe: true` to request a checkout suitable for embedding. Boolean coercion is already handled correctly by coerceToString (true -> "1", false -> "0"), so no coercion changes were needed. Bumps version 0.1.1 -> 0.2.0. --- CHANGELOG.md | 1 + README.md | 16 ++++++++++++++++ package.json | 2 +- src/internal/fieldOrders.ts | 1 + src/types.ts | 7 +++++-- src/version.ts | 2 +- test/sign-request.test.ts | 23 +++++++++++++++++++++++ test/type-safety.test.ts | 1 + 8 files changed, 49 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6e9a64..4c4899a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added +- Optional `iframe` field on `invoices.create` (`iframe?: boolean | number`). Like `paymentMode`, it is an unsigned passthrough — sent in the request body but excluded from the HMAC signature. Set `iframe: true` to request a checkout suitable for embedding. - Retry with exponential backoff and full jitter for transient failures (429, 5xx, network errors, timeouts), honoring `Retry-After`. Only replay-safe requests are retried — GETs, calls carrying an `Idempotency-Key`, and pure reads such as `payments.checkStatus`. Charges are never replayed. - `maxRetries` client option (default `2`; `0` disables). - `PaylinkApiError.retryAfterMs` and `PaylinkApiError.isRateLimited`. diff --git a/README.md b/README.md index fe2afc1..601dc09 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,22 @@ const checkout = await paylink.invoices.create({ console.log(checkout.checkoutUrl, checkout.invoiceId, checkout.expiresAt); ``` +Pass `iframe: true` to receive a `checkoutUrl` suitable for embedding — for +example rendering the hosted checkout inside an `