php - Payum Bundle 发送空付款 - Paypal 接受它 :) :(

标签 php symfony paypal payum

我根据这个例子配置 Bundle http://payum.forma-dev.com/documentation/0.8/PayumBundle/simple_purchase_examples/paypal_express_checkout

当我转到/payment 时,我被重定向到 PayPal 网站 - 但没有任何相关信息。

enter image description here

有信息-您可以看到详细信息-但这不是真的-我接受付款(不知道价格和描述-付款成功!?

此 Bundle 已准备好使用或处于工作阶段?

配置:

payum:
    security:
        token_storage:
            ed\partnerBundle\Entity\PayumSecurityToken:
                doctrine:
                    driver: orm
    contexts:
        frei_payment:
            paypal_express_checkout_nvp:
              api:
                  options:
                      username:  'myusername'
                      password:  'mypass'
                      signature: 'mysing'
                      sandbox: false
            storages:
                ed\partnerBundle\Entity\PaymentDetails:
                    doctrine:
                        driver: orm

路由:

payment_start:
    pattern:  /payment
    defaults: { _controller: edpartnerBundle:Payment:preparePaypalExpressCheckoutPayment }

edpartner_payment_done:
    pattern:  /payment/done
    defaults: { _controller: edpartnerBundle:Payment:done }

支付 Controller 中的操作:

  public function doneAction(){

        $request = $this->getRequest();

        $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->getRequest()->getSession()->getFlashBag()->set(
                'notice',
                'Payment success. Credits were added'
            );
        } else if ($status->isPending()) {
            $this->getRequest()->getSession()->getFlashBag()->set(
                'notice',
                'Payment is still pending. Credits were not added'
            );
        } else {
            $this->getRequest()->getSession()->getFlashBag()->set('error', 'Payment failed');
        }

        return $this->redirect('homepage');



    }

    /**
     */
    public function preparePaypalExpressCheckoutPaymentAction(){

        $paymentName = 'my_payment';

        $storage = $this->get('payum')->getStorageForClass(
            'ed\partnerBundle\Entity\PaymentDetails',
            $paymentName
        );

        /** @var \ed\partnerBundle\Entity\PaymentDetails $paymentDetails */
        $paymentDetails = $storage->createModel();
        $paymentDetails['PAYMENTREQUEST_0_CURRENCYCODE'] = 'USD';
        $paymentDetails['PAYMENTREQUEST_0_AMT'] = 1.23;
        $storage->updateModel($paymentDetails);

        $captureToken = $this->get('payum.security.token_factory')->createCaptureToken(
            $paymentName,
            $paymentDetails,
            'edpartner_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());



    }

最佳答案

您描述的行为是可能的,任何问题都在这里。要查看付款详细信息,您必须配置其他字段。 sandbox 中有一个示例

关于php - Payum Bundle 发送空付款 - Paypal 接受它 :) :(,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21277517/

相关文章:

php - 获取重力形式的输入值

php - 复杂的多表mysql查询

symfony - FOS\RestBundle,Symfony2 上的 "Unrecognized options"

symfony - 如何禁用表单选择类型中的特定项目?

php - Symfony2 - 使用 Doctrine 存储库的选择约束

asp.net-mvc - Paypal 使用哪个 KEY 以便我可以与我的网站同步?

php - PHP/Mysql 中的 Action Listener,每当有记录插入表中时?

php - 我应该如何从我网站上 2 个人之间的交易中扣款?

PHP - 接受多个支付网关

javascript - 在重复表单上使用 jQUERY,随后增加 ID