Search by

sol-parts / payum-portmone

AndriiDidenko

Payum gateway for Portmone.com acquiring: hosted checkout, preauth hold payments and refunds

Package info

github.com/sol-parts/payum-portmone

Homepage

pkg:composer/sol-parts/payum-portmone

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-29 13:12 UTC

This package is auto-updated.

Last update: 2026-11-29 13:26:06 UTC


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 with preauthFlag=Y: the funds are locked on the customer's card and the store settles the payment later.
  • DoCapture (the shared request from sol-parts/payum-contracts, when installed) — settle a preauth hold via confirmPreauth for the payment amount.
  • Cancel — release an active preauth hold via rejectPreauth. For any other state it is a no-op.
  • Refund — refund of a paid bill via return, 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 via result.
  • 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. result returns all of them, and the gateway picks the most significant one (PAYED, then PREAUTH, 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 RETURN and a negative amount, while the original bill stays PAYED. The gateway reports a refund made through Refund; a refund made elsewhere (for example in the merchant account) is not reflected by Sync.
  • The BankPay expiration time applies to the whole bill: once it passes, the bill becomes REJECTED for card payment too.
  • The signature timestamp dt is 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.