sol-parts / payum-portmone
Payum gateway for Portmone.com acquiring: hosted checkout, preauth hold payments and refunds
Requires
- php: >=8.2
- ext-json: *
- ext-mbstring: *
- payum/core: ^1.7
- php-http/discovery: ^1.14
- psr/http-factory: ^1.0
- psr/http-message: ^1.1|^2.0
Requires (Dev)
- nyholm/psr7: ^1.8
- phpunit/phpunit: ^11.5
Suggests
- sol-parts/payum-contracts: Dispatch the shared DoCapture request to settle (confirmPreauth) preauth hold payments
Provides
None
Conflicts
None
Replaces
None
README
Provides Portmone.com Payment Gateway integration for Payum: hosted checkout with instant debit or two-stage preauth hold payments, and refunds. Optional BankPay and installment payment methods can be enabled on the payment page.
Supported operations:
Capture— open the Portmone payment page. Portmone has no checkout URL: the browser posts a signed JSON (bodyRequest) to the gateway, so the action replies with an auto-submitted form (HttpPostRedirect).Authorize— same flow withpreauthFlag=Y: the funds are locked on the customer's card and the store settles the payment later.DoCapture(the shared request fromsol-parts/payum-contracts, when installed) — settle a preauth hold viaconfirmPreauthfor the payment amount.Cancel— release an active preauth hold viarejectPreauth. For any other state it is a no-op.Refund— refund of a paid bill viareturn, full payment amount.Notify— a JSON notification is treated as a sync trigger only: the state is always re-fetched server-to-server, and the action answers with the acknowledgement Portmone expects (errorCode,reason,responseId).Sync— re-fetch the payment state viaresult.GetStatus— maps Portmone bill statuses to Payum ones (see the table below).
Payment flow
sequenceDiagram
autonumber
actor C as Customer
participant S as Store
participant P as Portmone
C->>S: Places an order
S-->>C: Auto-submitted form with the signed bodyRequest
C->>P: POST /gateway/ — the payment page
C->>P: Pays
P-->>C: Redirect to successUrl / failureUrl
C->>S: Returns to the store
S->>P: method=result (shopOrderNumber)
S-->>C: Order result page
Loading
When the customer opens the payment again while the bill is still pending, the gateway first syncs the state and, if the order is still unpaid, signs a fresh request.
Status mapping
| Bill status | Payum status |
|---|---|
CREATED |
pending |
PREAUTH |
authorized — the funds are locked, the store settles via DoCapture |
PAYED |
captured |
RETURN |
refunded |
REJECTED after Cancel |
refunded — the hold was released by the store |
REJECTED |
failed |
Installation
composer require sol-parts/payum-portmone
Usage with PayumBuilder
use Payum\Core\GatewayFactoryInterface; use Payum\Core\PayumBuilder; use SolParts\PayumPortmone\PortmoneGatewayFactory; $payum = (new PayumBuilder()) ->addGatewayFactory('portmone', static function (array $config, GatewayFactoryInterface $coreGatewayFactory) { return new PortmoneGatewayFactory($config, $coreGatewayFactory); }) ->addGateway('portmone', [ 'factory' => 'portmone', 'payee_id' => 'your-payee-id', 'login' => 'your-login', 'password' => 'your-password', 'signature_key' => 'your-signature-key', ]) ->getPayum();
Usage with Symfony PayumBundle
Register the gateway factory:
# config/services.yaml services: app.portmone_gateway_factory: class: Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder arguments: [SolParts\PayumPortmone\PortmoneGatewayFactory] tags: - { name: payum.gateway_factory_builder, factory: portmone }
Configure a gateway:
# config/packages/payum.yaml payum: gateways: portmone: factory: portmone payee_id: '%env(PORTMONE_PAYEE_ID)%' login: '%env(PORTMONE_LOGIN)%' password: '%env(PORTMONE_PASSWORD)%' signature_key: '%env(PORTMONE_SIGNATURE_KEY)%'
Options
| Option | Required | Description |
|---|---|---|
payee_id |
yes | Merchant (payee) identifier issued by Portmone. |
login |
yes | Merchant login; also part of the checkout signature. |
password |
yes | Merchant password for the server-to-server methods (result, confirmPreauth, rejectPreauth, return). |
signature_key |
yes | Key of the HMAC-SHA256 checkout signature. |
bankpay |
no | Enable BankPay on the payment page. Portmone requires an expiration time for it, so the gateway sets expTime to 900 seconds unless the payment details provide one. |
installments |
no | Enable payment by installments; the payer phone from phoneNumber is sent in the national 9-digit format. |
When bankpay or installments is enabled, card payment is listed
explicitly: Portmone applies its default set of methods only when the
paymentTypes block is absent.
Payment details
ConvertPaymentAction fills shopOrderNumber, billAmount — in major
units, as a string with two decimals (15.47) — billCurrency and
description. successUrl and failureUrl default to the after-URL of the
payment token.
Caveats
- Every opening of the payment page creates a new Portmone bill with the same
shopOrderNumber.resultreturns all of them, and the gateway picks the most significant one (PAYED, thenPREAUTH,RETURN,CREATED,REJECTED), so an abandoned bill never hides the paid one. - The checkout request carries no notification URL. A notification arrives
only if a static URL is configured in the Portmone merchant account;
otherwise keep the state up to date with
Sync. - A refund is a separate Portmone bill with status
RETURNand a negative amount, while the original bill staysPAYED. The gateway reports a refund made throughRefund; a refund made elsewhere (for example in the merchant account) is not reflected bySync. - The BankPay expiration time applies to the whole bill: once it passes, the
bill becomes
REJECTEDfor card payment too. - The signature timestamp
dtis taken in Kyiv time regardless of the PHP time zone. - Error responses are reported with the HTTP status code and a truncated body snippet — balancer errors (429, 5xx) answer with HTML, not JSON.
License
Released under the MIT License.