如何为瑞士帐户启用Payum for Symfony的访客结帐?我使用Payum处理网站付款。问题在于快速结账功能,如图所示there:
<?php
//src/Acme/PaymentBundle/Controller
namespace AcmeDemoBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
class PaymentController extends Controller
{
public function preparePaypalExpressCheckoutPaymentAction()
{
$gatewayName = 'your_gateway_name';
$storage = $this->get('payum')->getStorage('Acme\PaymentBundle\Entity\PaymentDetails');
/** @var \Acme\PaymentBundle\Entity\PaymentDetails $details */
$details = $storage->create();
$details['PAYMENTREQUEST_0_CURRENCYCODE'] = 'USD';
$details['PAYMENTREQUEST_0_AMT'] = 1.23;
$storage->update($details);
$captureToken = $this->get('payum')->getTokenFactory()->createCaptureToken(
$gatewayName,
$details,
'acme_payment_done' // the route to redirect after capture;
);
return $this->redirect($captureToken->getTargetUrl());
}
}
未启用访客结帐。