Get started
Payum Bundle
Install
The preferred way to install the library is using composer. Run composer require to add dependencies to composer.json:
php composer.phar require "payum/payum-bundle" "payum/offline" "php-http/guzzle7-adapter"When using Symfony Flex, the bundle should automatically be added to the bundle config.
If that did not happen, or if you are not using Symfony Flex, then enable the bundle in the config
<?php
// config/bundles.php
return [
Payum\Bundle\PayumBundle\PayumBundle::class => ['all' => true],
];Now let's import Payum's routes:
# config/routes.yml
payum_all:
resource: "@PayumBundle/Resources/config/routing/all.xml"Configure
First we need two entities: Token and Payment.
The token entity is used to protect your payments, while the payment entity stores all your payment information.
Note: In this chapter we show how to use Doctrine ORM entities. There are other supported storages.
Next, you have to add mapping information, and configure payum's storages:
Note: You can add other gateways to the gateways key too.
Create payment and redirect the user
Now we can create a payment:
Payment is done
After setting up the payment, the user will be redirected to doneAction(). You can read more about it in its dedicated chapter. doneAction() is always called, no matter if the payment was successful or not. Here we may check the payment status, update the model, dispatch events and so on.
Supporting Payum
Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
Last updated