Purchase done action
<?php
$captureToken = $this->get('payum')->getTokenFactory()->createCaptureToken(
$gatewayName,
$details,
'acme_payment_done'
);<?php
use Payum\Core\Request\GetHumanStatus;
public function captureDoneAction(Request $request)
{
$token = $this->get('payum')->getHttpRequestVerifier()->verify($request);
$identity = $token->getDetails();
$model = $this->get('payum')->getStorage($identity->getClass())->find($identity);
$gateway = $this->get('payum')->getGateway($token->getGatewayName());
// you can invalidate the token. The url could not be requested any more.
// $this->get('payum')->getHttpRequestVerifier()->invalidate($token);
// Once you have token you can get the model from the storage directly.
//$identity = $token->getDetails();
//$details = $payum->getStorage($identity->getClass())->find($identity);
// or Payum can fetch the model for you while executing a request (Preferred).
$gateway->execute($status = new GetHumanStatus($token));
$details = $status->getFirstModel();
// you have order and payment status
// so you can do whatever you want for example you can just print status and payment details.
return new JsonResponse(array(
'status' => $status->getValue(),
'details' => iterator_to_array($details),
));
}Supporting Payum
Last updated