Download the PHP package core45/laravel-tubapay without Composer

On this page you can find all versions of the php package core45/laravel-tubapay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-tubapay

Laravel TubaPay

A Laravel integration for TubaPay BNPL (Buy Now, Pay Later) payment solutions.

Sits on top of core45/tubapay-php and gives you:


Table of Contents

  1. Requirements
  2. Installation
  3. Configuration
  4. How TubaPay Works (Flow Overview)
  5. End-to-End Integration Guide
    • Step 1 — Show TubaPay on checkout
    • Step 2 — Validate selection before creating the order
    • Step 3 — Persist the selection, then create the transaction
    • Step 4 — Handle webhooks
  6. Livewire Integration
  7. Webhook Events Reference
  8. Optional Default Listeners
  9. Blade Components
  10. Console Commands & Scheduling
  11. Transaction Tracking Model
  12. Agreement Statuses
  13. Configuration Options
  14. Translations
  15. Testing
  16. License

Requirements

Installation

The service provider is auto-discovered. Publish the config and migrations:

Migrations create:

Table Purpose
tubapay_transactions Local tracking row per transaction — status, amount, customer, installments, consents
tubapay_checkout_selections Short-lived store for the customer's installment/consent choices, keyed by your order reference
tubapay_webhook_events Idempotency log — deduplicates webhook deliveries by commandType:commandRef
tubapay_payments Merchant payout notifications (optional, populated by persistence layer)
tubapay_recurring_requests Recurring order requests from TubaPay (optional)

Configuration

Minimum .env:

Additional options (see config/tubapay.php for the full list):

How TubaPay Works (Flow Overview)

Two important moments to distinguish:


End-to-End Integration Guide

This section walks through a typical checkout integration. If you use Livewire, jump to Livewire Integration for adjustments to the Blade components.

Step 1 — Show TubaPay on checkout

Resolve installment and consent options for the current cart total and render the Blade components.

In the Blade view:

Cache the CheckoutOptions response per cart total — the SDK hits the TubaPay API each time you call forAmount().

Step 2 — Validate selection before creating the order

Before persisting the order, reject submissions that chose TubaPay with an incomplete selection:

Step 3 — Persist the selection, then create the transaction

After the order exists in your database, write a CheckoutSelection keyed by a reference you control — typically the order's UUID. Then create the TubaPay transaction, passing the selection explicitly to avoid the SDK silently falling back to defaults with empty consents.

Why pass selection explicitly? If you omit the selection argument, TubaPayCheckoutService will look for a stored selection by externalRef and — if none is found — fall back to a default CheckoutSelection with no accepted consents, which will likely be rejected by TubaPay or create an agreement the customer hasn't actually consented to. Always pass the explicit selection you validated in Step 2.

Step 4 — Handle webhooks

The package registers a webhook route at POST /webhooks/tubapay (configurable via TUBAPAY_WEBHOOK_PATH). Signature verification and idempotency happen automatically. You subscribe to the dispatched events in your own listeners.

Register them in AppServiceProvider::boot() (Laravel 11/12 style) or in an EventServiceProvider:

Example "mark order paid on credit acceptance" listener:

Example rejection listener:


Livewire Integration

The shipped Blade components use plain <input> tags bound to a name attribute. If you bind them to a Livewire component with wire:model / wire:model.live, you need to publish and patch the views so the binding lands on the <input> element rather than the wrapping <div>:

Then edit resources/views/vendor/tubapay/components/installment-selector.blade.php:

Apply the same pattern to consent-checkboxes.blade.php. Usage:

Be careful with --force. Re-publishing views with --force will overwrite your Livewire-bound copies. Commit the overrides to your repo and avoid --force after that.


Webhook Events Reference

Event TubaPay command When it fires Typical action
TransactionStatusChanged TRANSACTION_STATUS_CHANGED Credit application transitions through draft → registered → signed → accepted/rejected Mark order paid on isAccepted(); cancel on isRejected()
PaymentReceived TRANSACTION_MERCHANT_PAYMENT TubaPay has paid out funds to the merchant Log for bookkeeping; do not re-mark the order paid (it already is)
RecurringOrderRequested CUSTOMER_RECURRING_ORDER_REQUEST Customer's recurring billing cycle generates a new order Create the next local order against the saved agreement
InvoiceRequested (legacy alias of above) Same as RecurringOrderRequested Prefer RecurringOrderRequested for new code
WebhookReceived any Every incoming webhook (raw) Debugging / custom routing

Common methods on TransactionStatusChanged:

Webhook idempotency is handled by the tubapay_webhook_events table — duplicate deliveries with the same commandType:commandRef are acknowledged (HTTP 200) but not re-dispatched.


Optional Default Listeners

If you'd rather not write your own listeners and your order model can implement a small contract, the package can auto-register default listeners for accepted/rejected/payment/recurring events.

1. Implement the resolver:

2. Implement TubaPayTransactable on the order model:

3. Bind the resolver and enable auto-listeners:


Blade Components

Fetching the top bar content:


Console Commands & Scheduling

Schedule the prune task daily in routes/console.php:


Transaction Tracking Model

The row is created with currency = 'PLN' (the TubaPay platform's native currency) and status = draft. If your order is denominated in another currency (e.g. EUR), update the tracking row's currency after createTransaction() returns:


Agreement Statuses

Status Description isPending() isSuccessful() isFailed()
draft Initial state ✓
registered Application submitted ✓
signed Documents signed ✓
accepted Approved — customer is financed, merchant can fulfill ✓
rejected Application rejected ✓
canceled Canceled by customer ✓
terminated Terminated by system ✓
withdrew Customer withdrew ✓
repaid Fully repaid ✓
closed Agreement closed ✓

Configuration Options

See config/tubapay.php for the full list:

Use the status mapper from your listeners:


Optional UI Helper Routes

Enable JSON endpoints for client-side checkouts (SPA, fetch-based carts):

Method Path Route name Purpose
GET /tubapay/installments?amount=1000 tubapay.ui.installments Installments + consents + UI texts for amount
GET /tubapay/content/top-bar tubapay.ui.content.top-bar Top bar HTML content
GET /tubapay/content/popup tubapay.ui.content.popup Popup HTML content
GET /tubapay/texts tubapay.ui.texts Checkout UI text labels

Content responses are cached for TUBAPAY_UI_CACHE_TTL seconds.


Translations

Translations ship in en, pl, de, es, fr, it. Publish to customize:


Testing

End-to-end transaction creation is covered manually against the TubaPay sandbox because TubaPayCheckoutService is final and TubaPay client methods are not easily mocked. For unit tests, stub the TubaPay client binding:


License

MIT License. See LICENSE file for details.


All versions of laravel-tubapay with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
core45/tubapay-php Version ^0.2.1
illuminate/cache Version ^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/events Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package core45/laravel-tubapay contains the following files

Loading the files please wait ...