Download the PHP package bpotmalnik/lunar-tpay without Composer
On this page you can find all versions of the php package bpotmalnik/lunar-tpay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package lunar-tpay
lunar-tpay
Tpay Open API payment driver for LunarPHP.
The package provides:
Payments::driver('tpay')registration- Tpay OAuth token handling
- transaction creation and redirect authorization
- JWS-signed notification handling
- Lunar capture transaction creation after successful payment
- full and partial refunds through Tpay
- English and Polish error translations
- a
FakeTpayClientfor application tests
Requirements
- PHP 8.3+
- ext-openssl
- Laravel 12 or 13
- LunarPHP 1.x
Installation
Optionally publish translations:
Configuration
The package registers this notification route automatically:
When creating transactions, the adapter sends this URL in Tpay's callbacks.notification.url field. Tpay signs notification bodies using JWS in the X-JWS-Signature header.
Usage
Supported withData() keys:
| Key | Description |
|---|---|
continue_url |
Tpay success redirect URL. |
error_url |
Tpay error redirect URL. Defaults to continue_url. |
notification_url |
Override the webhook URL sent to Tpay. |
description |
Transaction description. |
lang |
Payment page language. Defaults to TPAY_LANG. |
method |
Optional Tpay payment method. Leave unset for the default Tpay payment page. |
group_id |
Optional Tpay payment group ID, e.g. 150 for BLIK or 103 for card. |
channel_id |
Optional Tpay channel ID. |
Notifications
Tpay sends successful payment notifications with data.transactionStatus set to correct. The package:
- verifies
X-JWS-Signatureusing Tpay's signing certificate and root CA, - looks up the local payment by
data.transactionIdordata.transactionHiddenDescription, - locks the payment row during processing,
- marks the Lunar intent transaction successful,
- creates a Lunar
capturetransaction, - sets
placed_aton the order, - updates the Lunar order status using
lunar.tpay.status_mapping, - dispatches
PaymentConfirmed.
The controller responds to accepted signed notifications with the literal body expected by Tpay:
Refunds
Refund amounts are passed in the smallest currency unit:
That creates a 50.00 PLN refund request against the original Tpay transaction. Tpay's refund API does not expose refund cancellation in the same transaction endpoint used here, so cancelRefund() returns a failed PaymentRefund response with an admin-facing message.
Events
Testing
The fake returns:
transactionId:01J9XH0PDXH1Q8C9MMEB3VJ0G6transactionPaymentUrl:https://secure.tpay.com/fake-redirectstatus:pending
Its notification signature verifier always returns true, which makes webhook feature tests straightforward.
Development
In local environments without ext-intl, install dependencies with:
Lunar itself requires ext-intl; some cart-calculation paths will still need it at runtime.
License
MIT. See LICENSE.md.
All versions of lunar-tpay with dependencies
php Version ^8.3
lunarphp/core Version ^1.0
illuminate/support Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0