Search by

sol-parts / payum-wayforpay

AndriiDidenko

Payum gateway for WayForPay acquiring: hosted checkout, AUTH hold payments, signed callbacks and refunds

Package info

github.com/sol-parts/payum-wayforpay

Homepage

pkg:composer/sol-parts/payum-wayforpay

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:28:11 UTC


README

Provides WayForPay acquiring integration for Payum: hosted checkout with instant debit (SALE) or two-stage hold payments (AUTH), signed callbacks and refunds. All signatures are HMAC-MD5 over the documented fields joined with ;.

Supported operations:

  • Capture — create the payment page server-to-server (PURCHASE with behavior=offline) and redirect the customer to the returned URL.
  • Authorize — same flow with merchantTransactionType=AUTH: 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 an AUTH hold via SETTLE for the payment amount.
  • Cancel — release an active AUTH hold via REFUND (result Voided). For any other state it is a no-op.
  • Refund — refund of a paid order via REFUND, full payment amount.
  • Notify — the serviceUrl callback triggers a CHECK_STATUS sync and is answered with the signed accept acknowledgement WayForPay requires.
  • Sync — re-fetch the order state via CHECK_STATUS.
  • GetStatus — maps WayForPay transaction statuses to Payum ones (see the table below).

Responses of CHECK_STATUS, SETTLE and REFUND are verified against their merchantSignature before the state is applied.

Payment flow

sequenceDiagram
    autonumber
    actor C as Customer
    participant S as Store
    participant W as WayForPay

    C->>S: Places an order
    S->>W: PURCHASE (behavior=offline)
    W-->>S: Payment page URL
    S-->>C: Redirect to the payment page
    C->>W: Pays
    W-->>C: Redirect to returnUrl
    W->>S: Callback to serviceUrl
    S->>W: CHECK_STATUS
    S-->>W: Signed accept
    S-->>C: Order result page
Loading

While an order is still payable the capture flow does not create a new payment: the returning customer is redirected to the same payment page.

Status mapping

Transaction status Payum status
InProcessing, Pending, RefundInProcessing pending
WaitingAuthComplete authorized — the funds are locked, the store settles via DoCapture
Approved captured
Refunded, Voided refunded — covers both a released hold and a refunded payment; the host application distinguishes them by the previous transaction state
Declined with reason code 1104 (insufficient funds) pending — the customer can retry on the same payment page
Declined failed
Expired expired

Statuses are matched case-insensitively.

Installation

composer require sol-parts/payum-wayforpay

Usage with PayumBuilder

use Payum\Core\GatewayFactoryInterface;
use Payum\Core\PayumBuilder;
use SolParts\PayumWayForPay\WayForPayGatewayFactory;

$payum = (new PayumBuilder())
    ->addGatewayFactory('wayforpay', static function (array $config, GatewayFactoryInterface $coreGatewayFactory) {
        return new WayForPayGatewayFactory($config, $coreGatewayFactory);
    })
    ->addGateway('wayforpay', [
        'factory' => 'wayforpay',
        'merchant_account' => 'your-merchant-account',
        'secret_key' => 'your-secret-key',
    ])
    ->getPayum();

Usage with Symfony PayumBundle

Register the gateway factory:

# config/services.yaml
services:
    app.wayforpay_gateway_factory:
        class: Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder
        arguments: [SolParts\PayumWayForPay\WayForPayGatewayFactory]
        tags:
            - { name: payum.gateway_factory_builder, factory: wayforpay }

Configure a gateway:

# config/packages/payum.yaml
payum:
    gateways:
        wayforpay:
            factory: wayforpay
            merchant_account: '%env(WAYFORPAY_MERCHANT_ACCOUNT)%'
            secret_key: '%env(WAYFORPAY_SECRET_KEY)%'

Options

Option Required Description
merchant_account yes Merchant account issued by WayForPay.
secret_key yes Merchant secret key used for all request and response signatures.

WayForPay publishes a test merchant for integration testing in its documentation.

Payment details

ConvertPaymentAction fills amount — in major units, as a string with two decimals (1547.36) — currency, orderReference, orderDate and a single product line with the payment description, so the product total always equals the payment amount including discounts and delivery.

The gateway attaches returnUrl to the after-URL of the payment token and serviceUrl to a notify token. merchantDomainName is taken from the returnUrl host unless the payment details provide it.

Caveats

  • REFUND is a single operation for both releasing a hold and refunding a captured payment. The gateway always uses the full payment amount; partial refunds are not implemented.
  • A REFUND response is signed with four fields only (merchantAccount, orderReference, transactionStatus, reasonCode), unlike CHECK_STATUS and SETTLE.
  • 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.