//in your payment controller, e.g. startPaymentAction
public function startPaymentAction() {
// ... some other stuff
$paymentConfig = new AbstractRequest($config);
$response = $checkoutManager->startOrderPaymentWithPaymentProvider($paymentConfig);
$checkoutManager = Factory::getInstance()->getCheckoutManager($cart);
$paymentInformation = $checkoutManager->initOrderPayment();
$payment = $checkoutManager->getPayment();
$config = [
'return_url' => $returnUrl,
'cancel_url' => $cancelUrl . 'payment?error=cancel',
'OrderDescription' => 'My Order ' . $order->getOrdernumber() . ' at pimcore.org',
'InternalPaymentId' => $paymentInformation->getInternalPaymentId()
];
$paymentConfig = new AbstractRequest($config);
$response = $checkoutManager->startOrderPaymentWithPaymentProvider($paymentConfig);
return new \Symfony\Component\HttpFoundation\JsonResponse($response->getJsonString(), 200, [], true);
}
public function handleResponseAction() {
// ... do some stuff
$checkoutManager = Factory::getInstance()->getCheckoutManager($cart);
$params = array_merge($request->query->all(), $request->request->all());
$order = $checkoutManager->handlePaymentResponseAndCommitOrderPayment($params);
// optional to clear payment
// if this call is necessary depends on payment provider and configuration.
// its possible to execute this later (e.g. when shipment is done)
// $payment = $checkoutManager->getPayment();
// $paymentStatus = $payment->executeDebit();
// $orderAgent = Factory::getInstance()->getOrderManager()->createOrderAgent($order);
// $orderAgent->updatePayment($paymentStatus);
// ... check order state and redirect user to error page or order success page
}