小编Mak*_*yar的帖子

实施Payum/Laravel定期付款

我有一些问题试图让这个工作,我已经成功实现了checkout express(或似乎),但我的系统需要订阅选项,遵循此示例.

现在,我的问题是,在Laravel你不能简单地放一些随机文件,所以我试图以正确的方式做到这一点,遗憾的是,没有关于库的类和方法的文档.

我在控制器中创建了一些功能(我不知道这是不是正确的方法)我现在面临的问题是尝试createRecurringPayment()来应用所需的定期付款金额,这是我猜的最后一步.

谢谢你的帮助.

  • 应用程序/控制器/ PaypalController.php

    public function prepareExpressCheckout(){
        $storage = $this->getPayum()->getStorage('Payum\Core\Model\ArrayObject');
        $details = $storage->createModel();
        $details['PAYMENTREQUEST_0_CURRENCYCODE'] = 'USD';
        $details['PAYMENTREQUEST_0_AMT'] = 1.23;
        $storage->updateModel($details);
        $captureToken = $this->getTokenFactory()->createCaptureToken('paypal_es', $details, 'payment_done');
        $details['RETURNURL'] = $captureToken->getTargetUrl();
        $details['CANCELURL'] = $captureToken->getTargetUrl();
        $storage->updateModel($details);
        return \Redirect::to($captureToken->getTargetUrl());
    }
    
    public function prepareSubscribe(){
        $storage = $this->getPayum()->getStorage('Payum\Core\Model\ArrayObject');
        $details = $storage->createModel();
    
        $details['PAYMENTREQUEST_0_AMT'] = 0;
        $details['L_BILLINGTYPE0'] = Api::BILLINGTYPE_RECURRING_PAYMENTS;
        $details['L_BILLINGAGREEMENTDESCRIPTION0'] = "Suscripción por X meses";
        $details['NOSHIPPING'] = 1;
    
        $storage->updateModel($details);
        $captureToken = $this->getTokenFactory()->createCaptureToken('paypal_es', $details, 'payment_done');
        $storage->updateModel($details);
    
        return \Redirect::to($captureToken->getTargetUrl());
    }
    
    public function createRecurringPayment(){
        $payum_token = Input::get('payum_token'); …
    Run Code Online (Sandbox Code Playgroud)

php paypal laravel payum

16
推荐指数
1
解决办法
2719
查看次数

标签 统计

laravel ×1

paypal ×1

payum ×1

php ×1