Install PayPal Express Checkout library
masterTo use PayPal Express Checkout with Payum, you must install the specific NVP (Name-Value Pair) library via Composer.
$ composer require "payum/paypal-express-checkout-nvp"repository·master·Indexed 20 days ago
https://github.com/payum/payumbundlePayumBundle integrates the Payum payment library into the Symfony framework. It provides a configuration layer for gateways and storages, secured capture controllers, and CLI tools for managing payment tokens and debugging gateways. The bundle supports various storage drivers including filesystem, ORM, and MongoDB, and integrates with gateways such as PayPal, Stripe, Authorize.Net, Be2Bill, Payex, Klarna, and Omnipay.
To use PayPal Express Checkout with Payum, you must install the specific NVP (Name-Value Pair) library via Composer.
$ composer require "payum/paypal-express-checkout-nvp"To use the PayPal Pro Checkout gateway, you must install the specific NVP (Name-Value Pair) library via Composer.
$ composer require "payum/paypal-pro-checkout-nvp"To use the Be2bill onsite gateway, install the required Payum library via Composer:
$ composer require "payum/be2bill"When upgrading from version 2.0 to 2.1, several global services have been removed. Instead of using these services directly, you must now use the gateway's configuration to overwrite them.
Removed services:
payum.http_clientpayum.iso4217payum.guzzle_clientTo refund a previously purchased order, retrieve the appropriate gateway (e.g., 'offline') and execute a Refund request using the payment object. After the refund request, you should execute a GetHumanStatus request to verify if the refund was successful. If isRefunded() returns false, inspect the payment's details via $payment->getDetails() to diagnose the failure.
<?php
use Payum\Core\Request\Refund;
use Payum\Core\Request\GetHumanStatus;
$gateway = $this->payum->getGateway('offline');
// Execute the refund
$gateway->execute(new Refund($payment));
// Check the status of the payment
$status = $gateway->execute(new GetHumanStatus($payment));
if ($status->isRefunded()) {
// Refund went well
} else {
// Something went wrong. Check details to find out why
var_dump($payment->getDetails());
}To use Stripe as a gateway through the Omnipay bridge, install the necessary libraries using Composer:
$ composer require "payum/omnipay-bridge" "omnipay/stripe:~2.0"To use the Be2bill credit card gateway with Payum, install the specific gateway library via Composer.
$ composer require "payum/be2bill"To use Propel, you need to build your schema (either your own or by copying the one from Payum\Core\Bridge\Propel\Resources\config\schema.xml) and implement the required model classes.
Token class extending the generated BaseToken and implementing Payum\Core\Security\TokenInterface.Payment class extending the generated BasePayment and implementing Payum\Core\Model\PaymentInterface.payum.yml using the propel1 or propel2 driver.payum:
security:
token_storage:
Acme\\DemoBundle\\Model\\Token: { propel1: ~ }
storages:
Acme\\DemoBundle\\Model\\Payment: { propel1: ~ }If the built-in storages do not meet your needs, you can implement your own by implementing the Payum\Core\Storage\StorageInterface.
StorageInterface.payum.yml using the syntax model_class: { custom: service_id }.namespace Acme\\PaymentBundle\\Payum\\Storage;
use Payum\\Core\\Storage\\StorageInterface;
class CustomStorage implements StorageInterface
{
// implement interface methods.
}# config/packages/payum.yml
services:
acme.payment.payum.storage.custom:
class: Acme\\PaymentBundle\\Payum\\Storage\\CustomStorage
payum:
storages:
Acme\\PaymentBundle\\Model\\Foo:
custom: acme.payment.payum.storage.customUpgrading from 0.8 to 0.9 includes changes to how actions are loaded and how configuration is structured:
payment/foo.xml file via tags.api.options sub-option has been removed. Options are now moved to the root of the factory section.storages section has moved from inside a context to the root payum section. By default, storages are now added to all payments.be2bill no longer supports onsite payments; use the be2bill_onsite factory instead.StorageFactoryInterface::create has changed; the second contextName and fourth paymentId arguments were removed.### Configuration Migration Example
**Before (0.8):**
```yml
payum:
a_context:
a_factory:
api:
options:
foo: foo
bar: barAfter (0.9):
payum:
a_context:
a_factory:
foo: foo
bar: barBefore (0.8):
payum:
a_context:
a_factory:
storages:
Acme\PaymentBundle\Entity\PaymentDetails:
doctrine:
driver: ormAfter (0.9):
payum:
storages:
Acme\PaymentBundle\Entity\PaymentDetails:
payment:
contexts: [a_factory]
doctrine: orm
a_context:
a_factory: To allow managing gateways (adding, deleting, or changing credentials) via a backend interface instead of static YAML files, you must use dynamic gateways. This requires implementing a storage mechanism for gateway configurations.
Payum\Core\Model\GatewayConfigInterface. If using Doctrine ORM, extend Payum\Core\Model\GatewayConfig.payum.yml configuration file under dynamic_gateways and specify the config_storage.Note: If a gateway is defined in both config.yml and the backend storage with the same name, the backend configuration takes precedence.
<?php
namespace Acme\PaymentBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Payum\Core\Model\GatewayConfig as BaseGatewayConfig;
/**
* @ORM\Table
* @ORM\Entity
*/
class GatewayConfig extends BaseGatewayConfig
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
protected int $id;
}To use the built-in Payum routes, import the bundle's routing configuration in your Symfony application.
# config/routes/payum.yaml
payum_all:
resource: "@PayumBundle/Resources/config/routing/all.xml"