Fix Paystack Fullscreen permission policy for Inline iframes.
Deploy Ladill POS / deploy (push) Successful in 1m4s
Deploy Ladill POS / deploy (push) Successful in 1m4s
Pre-set allow=fullscreen on Paystack iframes before navigation (createElement hook + MutationObserver on allow/src/id), re-apply if Paystack overwrites allow, and send Permissions-Policy HTTP headers so checkout.paystack.com can use fullscreen inside the in-app sheet.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Delegate payment-related browser features to Paystack Inline iframes.
|
||||
*
|
||||
* Cross-origin checkout.paystack.com needs the top-level document to allow
|
||||
* fullscreen (and payment/clipboard) via Permissions-Policy. Meta tags are
|
||||
* not reliably honored — this must be an HTTP response header.
|
||||
*/
|
||||
class PaystackPermissionsPolicy
|
||||
{
|
||||
public const HEADER_VALUE = 'payment=*, fullscreen=*, clipboard-read=*, clipboard-write=*, publickey-credentials-get=*';
|
||||
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
/** @var Response $response */
|
||||
$response = $next($request);
|
||||
|
||||
if (! $response->headers->has('Permissions-Policy')) {
|
||||
$response->headers->set('Permissions-Policy', self::HEADER_VALUE);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user