Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token parameter not set in request #571

Open
MasterPuffin opened this issue Mar 14, 2025 · 0 comments
Open

Token parameter not set in request #571

MasterPuffin opened this issue Mar 14, 2025 · 0 comments

Comments

@MasterPuffin
Copy link

In PayumBundle/Security/HttpRequestVerifier.php:39

if (! $hash = $httpRequest->attributes->get('payum_token', $httpRequest->get('payum_token', false))) {
            throw new NotFoundHttpException('Token parameter not set in request');
       }

This line checks if the payum_token parameter is valid. However Stripe doesn't append this parameter to the url nor to the attributes. It is only set if you access

$content = $request->getContent();
$data = json_decode($content, true);
$data['data']['object']['metadata']['token_hash']

one workaround would be to write the token_hash to the url with

$request->attributes->set('payum_token', $tokenHash);
$request->request->set('payum_token', $tokenHash);

however this will fail the following check

if (! RequestTokenVerifier::isValid($httpRequest->getUri(), $token->getTargetUrl())) {
                throw new HttpException(400, sprintf('The current url %s not match target url %s set in the token.', $httpRequest->getUri(), $token->getTargetUrl()));
            }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant