feat: embedded iframe checkout option (one-off payments) - #2
Merged
Conversation
Add an "Embedded Checkout" gateway option that renders the GetPayIn hosted checkout in an iframe instead of redirecting to it. When enabled, the plugin sends iframe=1 on the v2 init call so the returned Laravel-signed checkout_url carries the flag (appending it to the URL would break the signed middleware), embeds that URL, and listens for the checkout's signed paylink_payment postMessage to move the top window to the shop's return (success) or error (failure) URL. The listener accepts messages only from the configured GetPayIn origin, so a foreign frame cannot spoof an outcome. Applies to one-off payments only; recurring subscriptions always redirect because the recurring init endpoint does not sign the iframe flag. Bumps version to 1.3.0 and documents the option in the README, CHANGELOG, and the .pot translation template.
MHJaafar9869
force-pushed
the
feat/embedded-iframe-checkout
branch
from
August 6, 2026 09:55
4f2ede5 to
67007fc
Compare
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 Embedded Checkout gateway option that renders the GetPayIn hosted checkout in an iframe on the merchant's site instead of redirecting to it. It's a config toggle (No/Yes) alongside the existing options (Payment Action, Installments, etc.).
How it works
When Embedded Checkout = Yes for a one-off payment:
createCheckoutUrl()sendsiframe=1in the v2initPOST body. The backend (API/V2/.../ExternalPaymentIntegrationController::generateInvoice) readsiframefrom the body and bakesiframe=1into the signedcheckout_urlbefore signing — so this is the correct trigger. (Appending&iframe=1to the returned URL would break thesignedmiddleware.)beginTransaction()branches torenderIframe()(the original redirect path is preserved asrenderRedirect()).renderIframe()embeds the checkout and installs amessagelistener matching the backend'spaylink_paymentpostMessage contract —{type, success, invoice_id, invoice_status, message}. On success it moves the top window toreturn_url, on failure toerror_url.Safety / correctness guards
postMessageat the integration's registered Origin, so it's only delivered to a parent on that exact origin.)iframeEnabled()returns false for subscriptions, because the recurring init endpoint does not sign the iframe flag. Those keep redirecting.allow="payment *"on the iframe for Apple/Google Pay in the cross-origin frame, plus atarget="_top"fallback link for browsers that block third-party frames.Verification
php -lclean across all files; signing golden-vector tests pass (ALL SIGNATURE CHECKS PASSED).SecurityHeadersMiddlewareframe-ancestors, blade postMessage payloads).return_urlatbeginTransactiontime; if empty for a given component, the listener falls back to reloading the top window rather than landing on the order page.Bumps version 1.2.1 → 1.3.0; documents the option in README, CHANGELOG, and the
.pottemplate.