feat: optional iframe init option on invoices.create - #16
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional
iframefield toinvoices.create, mirroring the existing unsignedpaymentModepassthrough. Setiframe: trueto request a checkout suitable for embedding.The GetPayIn v2 init endpoint reads
iframeas a boolean via Laravel$request->boolean('iframe')(treats"1"/"true"as true). LikepaymentMode, it is unsigned — sent in the request body but excluded from the HMAC signature.This SDK remains server-side only: no browser/DOM/postMessage embed helper is added — just the init option.
Changes
src/types.ts— addediframe?: boolean | numbertoCreateInvoiceParams; updated the doc comment to note it is an optional unsigned passthrough likepaymentMode.src/internal/fieldOrders.ts— added{ sdk: 'iframe', wire: 'iframe', signed: false }after thepaymentModeentry inINVOICE_CREATE.fields.coerceToStringalready mapstrue -> "1"/false -> "0"(Laravel-boolean-truthy). No coercion change was required.iframetest totest/sign-request.test.ts(assertsbody.iframe === "1"and that the signature is identical with/withoutiframe); addediframeto the accepted-keys spec intest/type-safety.test.ts.iframe: trueembedded-checkout example; CHANGELOG[Unreleased] -> Addednotes the field.0.1.1 -> 0.2.0inpackage.jsonandsrc/version.ts(kept in sync per the existingretry.test.tsguard).Verification
npm test— 109 passed (10 files)npm run typecheck— cleannpm run build— ESM + CJS + DTS all succeednpm run lintandnpm run format:check— cleanNo shared golden vectors were modified; only SDK-local tests were added.