Search by

webx-ui / module-payments

Ahabzig

Payments for a WebX UI shop: the methods of the site, the attempts to pay an order, and the journal of every exchange with a payment gateway — raw bodies as sent and received, the shop's keys masked, append-only.

Package info

github.com/webx-ui/module-payments

Homepage

Issues

pkg:composer/webx-ui/module-payments

Statistics

Installs: 5

Dependents: 1

Suggesters: 0

Stars: 0

v0.94.0 2026-11-06 19:32 UTC

This package is auto-updated.

Last update: 2026-11-06 19:33:35 UTC


README

Payments for a WebX UI shop on Laravel: the methods of the site, the attempts to pay an order, and the journal of every exchange with a payment gateway.

Methods on receipt and by bank transfer are built in; an online gateway comes as a satellite package payment-<gateway> on the contract of this one, with the hold, the poll and the problems handled by the base. The panel section «Payments», the order's tab «Payment», the agent's tools and the letters come with it.

Install

composer require webx-ui/module-payments
php artisan migrate

Requires webx-ui/module-orders (and through it webx-ui/module-cart).

The exchange journal

Everything sent to a gateway and everything it sends back is one row of payment_gateway_events: direction, kind, URL, headers, the raw body as it went, status code, time, duration, the signature check and the decision of the base. Rows are only added; the decision is written once.

use WebxUi\Payments\Exchange\ExchangeContext;
use WebxUi\Payments\Exchange\ExchangeJournal;
use WebxUi\Payments\Exchange\ExchangeKind;
use WebxUi\Payments\Exchange\ExchangeSecrets;
use WebxUi\Payments\GatewayHttp;

$http = new GatewayHttp(
    app(ExchangeJournal::class),
    config(),
    new ExchangeContext(gateway: 'gateway-a', methodKey: 'gateway-a-card', paymentId: $payment->id, orderId: $payment->order_id, source: 'poll'),
    new ExchangeSecrets($credentials, headers: ['X-Token'], fields: ['access_token']),
    ExchangeKind::Status,
);

$answer = $http->request()->post('https://gateway-a.test/api/status', ['order_id' => $payment->uuid]);
  • Masking — the method's keys wherever they stand (as is, url-encoded, JSON-escaped, in base64), secret headers, the gateway's secret fields and card numbers. The signature is kept.
  • Size — a body is kept whole up to 1 MB (webx-payments.exchange.body_limit); above it the first megabyte, with the full size and sha256.
  • Its own connection — a copy of the default connection: an event commits by itself and is not rolled back with a failed status change. A failed write is logged and the payment goes on.
  • Pruning — never by itself: php artisan webx:payments:exchange-prune --days=N, N at least 365, with --dry-run and a confirmation.

Configuration

php artisan vendor:publish --tag=webx-payments-config:

Key Default What
exchange.connection copy of the default WEBX_PAYMENTS_EXCHANGE_CONNECTION
exchange.body_limit 1 MB bytes kept of one body, up to 16 MB
exchange.warn_size 1 GB webx:doctor notes a bigger journal
http.timeout, http.connect_timeout 15, 5 seconds of a gateway request
groups three groups the groups of the buyer's list

The groups of a site and official files of the marks: Groups and marks.

License

MIT. The payment marks in resources/marks/ are trademarks of their owners and are not covered by it: see NOTICE.md.