'providers' => array(
....
'Payum\LaravelPackage\PayumServiceProvider',
)
use Payum\Core\Storage\FilesystemStorage;
use Payum\Paypal\ExpressCheckout\Nvp\PaymentFactory as PaypalPaymentFactory;
use Payum\Paypal\ExpressCheckout\Nvp\Api;
$detailsClass = 'Payum\Core\Model\ArrayObject';
$tokenClass = 'Payum\Core\Model\Token';
$paypalPayment = PaypalPaymentFactory::create(new Api( array(
'username' => 'xxxxxxxxxxxxx',
'password' => 'xxxxxxxxxxxxx',
'signature' => 'xxxxxxxxxxxxx',
'sandbox' => true
)));
return array(
// You can pass on object or a service id from container.
'token_storage' => new FilesystemStorage(__DIR__.'/../../../../storage/payments', $tokenClass, 'hash'),
'payments' => array(
// Put here any payment you want too, omnipay, payex, paypa, be2bill or any other. Here's example of paypal and stripe:
'paypal_es' => $paypalPayment
),
'storages' => array(
$detailsClass => new FilesystemStorage(__DIR__.'/../../../../storage/payments', $detailsClass),
)
);
$storage = $this->getPayum()->getStorage('Payum\Core\Model\ArrayObject');
$details = $storage->createModel();
$details['PAYMENTREQUEST_0_CURRENCYCODE'] = 'USD';
$details['PAYMENTREQUEST_0_AMT'] = 100;
$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());
$details['L_PAYMENTREQUEST_0_NAME0'] = 'sample item';
$details['L_PAYMENTREQUEST_0_DESC0'] = 'sample desc';
$details['L_PAYMENTREQUEST_0_AMT0'] = 8.30;
$details['L_PAYMENTREQUEST_0_QTY0'] = 1;