Develop a custom Payum gateway
This chapter could be useful for a developer who wants to create a gateway on top of payum. The Payum provides a skeleton project which helps us a lots.
Create new project
$ composer create-project payum/skeletonReplace all occurrences of
payumwith your vendor name. It may be your github name, for now let's say you choose:acme.Replace all occurrences of
skeletonwith a payment gateway name. For example Stripe, Paypal etc. For now let's say you choose:paypal.Register a gateway factory to the payum's builder and create a gateway:
<?php
use Payum\Core\PayumBuilder;
$defaultConfig = [];
$payum = (new PayumBuilder)
->addGatewayFactory('paypal', new \Acme\Paypal\PaypalGatewayFactory($defaultConfig))
->addGateway('paypal', [
'factory' => 'paypal',
'sandbox' => true,
])
->getPayum()
;Or, if your are working on the bases of Symfony, you can define it in a service that way :
While using the gateway implement all method where you get
Not implementedexception:
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