Php symfony2 payum paypal express简单结账

Php symfony2 payum paypal express简单结账,php,symfony,paypal,payum,Php,Symfony,Paypal,Payum,我是新来的帕尤姆。很多事情让我很困惑。我正在尝试建立一个简单的paypal express结账,如Payum上的示例所示。但是,当我尝试处理付款时,它显示了一个异常: “名为my\u paypal\u express\u checkout的Payum付款不存在。 500内部服务器错误-InvalidArgumentException“ 以下是配置: payum: security: token_storage: Acme\PaymentBundle\Entity\Payu

我是新来的帕尤姆。很多事情让我很困惑。我正在尝试建立一个简单的paypal express结账,如Payum上的示例所示。但是,当我尝试处理付款时,它显示了一个异常:

“名为my\u paypal\u express\u checkout的Payum付款不存在。 500内部服务器错误-InvalidArgumentException“

以下是配置:

payum:
security:
    token_storage:
        Acme\PaymentBundle\Entity\PayumSecurityToken:
            doctrine:
                driver: orm
storages:
    Acme\PaymentBundle\Entity\PaymentDetails:
        doctrine: 
            driver: orm

contexts:
    Ibase_paypal_express:
        paypal_express_checkout_nvp:
         ...codes...
以下是控制器中准备和完成操作的代码:

public function preparePaypalAction(Request $request)
{
    $paymentName = 'ibase_paypal_express_checkout';

    $form = $this->createPurchaseForm();
    $form->handleRequest($request);
    if ($form->isValid()) {
        $data = $form->getData();

        $storage = $this->get('payum')->getStorage('Ibase\PaymentBundle\Entity\PaymentDetails');

        /** @var \Ibase\CartBundle\Entity\PaymentDetails $paymentDetails */
        $paymentDetails = $storage->createModel();
        $paymentDetails['PAYMENTREQUEST_0_CURRENCYCODE'] = $data['currency'];
        $paymentDetails['PAYMENTREQUEST_0_AMT'] = $data['amount'];//total amount ??
        $storage->updateModel($paymentDetails);

        $captureToken = $this->get('payum.security.token_factory')->createCaptureToken(
            $paymentName,
            $paymentDetails,
            'payment_done' // the route to redirect after capture;
        );

        $paymentDetails['INVNUM'] = $paymentDetails->getId();
        $paymentDetails['RETURNURL'] = $captureToken->getTargetUrl();
        $paymentDetails['CANCELURL'] = $captureToken->getTargetUrl();
        $storage->updateModel($paymentDetails);

        return $this->redirect($captureToken->getTargetUrl());
    }
    return $this->render('PaymentBundle:PaypalExpress:paypalPrepare.html.twig', array(
        'form' => $form->createView(),
        'paymentName' => $paymentName
    ));
}

public function doneAction(Request $request)
{
    $token = $this->get('payum.security.http_request_verifier')->verify($request);

    $payment = $this->get('payum')->getPayment($token->getPaymentName());

    $status = new BinaryMaskStatusRequest($token);
    $payment->execute($status);

    if ($status->isSuccess()) {
        $this->getUser()->addCredits(100);
        $this->get('session')->getFlashBag()->set(
            'notice',
            'Payment success. Credits were added'
        );
    } else if ($status->isPending()) {
        $this->get('session')->getFlashBag()->set(
            'notice',
            'Payment is still pending. Credits were not added'
        );
    } else {
        $this->get('session')->getFlashBag()->set('error', 'Payment failed');
    }

    return $this->redirect('home');
}

 /**
 * @return \Symfony\Component\Form\Form
 */
protected function createPurchaseForm()
{
    return $this->createFormBuilder()
        ->add('amount', null, array(
            'data' => 1,
            'constraints' => array(new Range(array('max' => 2)))
        ))
        ->add('currency', null, array('data' => 'AUD'))
        ->getForm()
    ;
}
任何能帮忙的人都将不胜感激

查看您的YML文件

contexts:
    Ibase_paypal_express:
以及您的代码:

$paymentName = 'ibase_paypal_express_checkout';
注意大写字母“I”和字符串名称吗?这两个名称/值应相同。 所以

$paymentName = 'Ibase_paypal_express'; 


谢谢@Qemal Stafa!可能是因为我的英语理解能力差,我没有从文件中得到任何提示,表明它们应该是一样的。无论如何,再次谢谢!
contexts:
    ibase_paypal_express_checkout: