Payum / PayumLaravelPackage

Payum offers everything you need to work with payments. From simplest use cases to very advanced ones.
https://payum.forma-pro.com/
MIT License
122 stars 38 forks source link

Recurring #9

Closed karlimlengco closed 10 years ago

karlimlengco commented 10 years ago

Is this support Recurring method in paypal?

makasim commented 10 years ago

the lib itself support it. you can adopt this example to laravel http://payum.org/doc/0.10/PaypalExpressCheckoutNvp/recurring-payments-basics

karlimlengco commented 10 years ago

Thanks

karlimlengco commented 10 years ago

hi, what this error means? Resolving timed out after 5514 milliseconds

makasim commented 10 years ago

something failed due timeout, dont know any special details

karlimlengco commented 10 years ago

can internet connection may cause it?

karlimlengco commented 10 years ago

hi again. i recieved ack: success but in paypal payment is not save, did i missed something? this is my create code, thanks

<?php

        $request = \App::make('request');
        $request->attributes->set('payum_token', Input::get('payum_token'));

        $token = $this->getHttpRequestVerifier()->verify($request);

        $payment = $this->getPayum()->getPayment($token->getPaymentName());

        $agreementStatus = new SimpleStatusRequest($token);

        $payment->execute($agreementStatus);

        $recurringPaymentStatus = null;
        if (false == $agreementStatus->isSuccess()) {
            header('HTTP/1.1 400 Bad Request', true, 400);
            exit;
        }

        $agreementDetails = $agreementStatus->getModel();

        $storage = $this->getPayum()->getStorage('Scribe\Models\Frontend\RecurringPaymentDetails');

        $recurringPaymentDetails = $storage->createModel();
        $recurringPaymentDetails['TOKEN'] = $agreementDetails['TOKEN'];
        $recurringPaymentDetails['DESC'] = $agreementDetails['L_BILLINGAGREEMENTDESCRIPTION0'];
        $recurringPaymentDetails['EMAIL'] = $agreementDetails['EMAIL'];
        $recurringPaymentDetails['AMT'] = $agreementDetails['AMT'];
        $recurringPaymentDetails['CURRENCYCODE'] = 'USD';
        $recurringPaymentDetails['BILLINGFREQUENCY'] = 30;
        $recurringPaymentDetails['PROFILESTARTDATE'] = date(DATE_ATOM);
        $recurringPaymentDetails['BILLINGPERIOD'] = Api::BILLINGPERIOD_DAY;

        $payment->execute(new CreateRecurringPaymentProfileRequest($recurringPaymentDetails));
        $payment->execute(new SyncRequest($recurringPaymentDetails));

        $doneToken = \App::make('payum.security.token_factory')->createToken('paypal_es', $recurringPaymentDetails, 'http://localhost:8000/recurring/done');

        return \Redirect::to($doneToken->getTargetUrl());
makasim commented 10 years ago

Config?

karlimlengco commented 10 years ago

This is my whole config

<?php

use Buzz\Client\Curl;
use Payum\Core\Storage\FilesystemStorage;
use Payum\Paypal\ExpressCheckout\Nvp\Api;
use Payum\Paypal\ExpressCheckout\Nvp\PaymentFactory as PaypalPaymentFactory;

$detailsClass = 'Payum\Core\Model\ArrayObject';
$agreement = 'Scribe\Models\Frontend\AgreementDetails';
$recurring = 'Scribe\Models\Frontend\RecurringPaymentDetails';
$tokenClass = 'Payum\Core\Model\Token';

$paypalPayment = PaypalPaymentFactory::create(new Api(new Curl, array(
    'username' => 'xxxx',
    'password' => 'xxxx',
    'signature' => 'xxxx',
    'sandbox' => true
)));

return array(
    'token_storage' => new FilesystemStorage(__DIR__.'/../../../../storage/payments', $tokenClass, 'hash'),
    'payments' => array(
        'paypal_es' => $paypalPayment,
    ),
    'storages' => array(
        $detailsClass => new FilesystemStorage(__DIR__.'/../../../../storage/payments', $detailsClass),
        $agreement => new FilesystemStorage(__DIR__.'/../../../../storage/payments', $agreement),
        $recurring => new FilesystemStorage(__DIR__.'/../../../../storage/payments', $recurring),
    )
);
makasim commented 10 years ago

@karlimlengco first, could you try to comment out storage for $detailsClass.

karlimlengco commented 10 years ago

i got it working, but in paypal it create two payment 1. Payment form = Completed, 2. Recurring Payment form = Created. is this correct?

nrnaveen commented 10 years ago

Iiam getting this error what can i do for this error.but code is same as here. Method [getHttpRequestVerifier] does not exist.