Download the PHP package ahmedibrahimyassindev/tamara-php-sdk without Composer

On this page you can find all versions of the php package ahmedibrahimyassindev/tamara-php-sdk. 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 tamara-php-sdk

Tamara Payment PHP SDK (Generic & Standalone)

Unofficial third-party SDK. This community project is not developed, maintained, or endorsed by Tamara.

Latest Stable Version Total Downloads PHP Version

A third-party PHP library for integrating Tamara Buy Now Pay Later into PHP applications. The core can be used without a web framework, with optional Laravel integration.


Features

Why this SDK?

Tamara also publishes an official PHP SDK as tamara-solution/php-sdk. Choose that package when you want Tamara's official API client and transport integrations. Choose this package when you want its orderable entity trait, webhook processor, and optional Laravel service provider.

Official Tamara SDK This community SDK
Composer package tamara-solution/php-sdk ahmedibrahimyassindev/tamara-php-sdk
PHP namespace Tamara\ TamaraPhpSdk\
Maintainer Tamara Community project; not endorsed by Tamara
HTTP dependencies Guzzle/Buzz and supporting PSR HTTP packages PHP cURL extension and psr/log
Laravel integration No Laravel provider or facade shown in the official README Auto-discovered service provider, TamaraPhpSdk facade, and publishable config
Webhook handling API client and notification-related services Webhook processor with atomic deduplication, state tracking, and partial capture/refund states
Endpoint coverage Broader API coverage, including payment-type lookup and refund operations Checkout, authorisation, capture, and cancel; payment-type lookup and refund API support are not implemented yet

The distinct namespace allows both packages to be installed together without this SDK claiming the official SDK's Tamara\ prefix.

Upgrade note for v2

Version 2 changes all SDK imports from Tamara\... to TamaraPhpSdk\.... The optional Laravel facade alias changes from Tamara to TamaraPhpSdk. Update imports and facade references when upgrading from v1.


Installation


Configuration

Set the following environment variables (or pass them directly into TamaraClient):

In Laravel, TAMARA_AUTO_AUTHORISE=true enables authorisation in the webhook processor resolved by the service provider. Set TAMARA_REQUIRES_SHIPPING_ADDRESS=false for checkouts that contain no shippable goods. Laravel webhook processing uses the configured cache store for atomic event claims; use a persistent shared store such as Redis, database, or file cache in production. For capture and refund events, the service-created processor checks Tamara's current remote status so multiple partial captures and refunds can advance the local state through partially_captured, partially_refunded, and their completed states. Models that do not use TamaraOrderableTrait should handle the _tamara_order_status callback field or implement onTamaraPartiallyCaptured() and onTamaraPartiallyRefunded().


Quick Start

1. Make Your Model Orderable

Implement TamaraPhpSdk\Contracts\TamaraOrderableInterface (you can use TamaraPhpSdk\Traits\TamaraOrderableTrait to satisfy all default methods):

The entity must be able to persist tamara_order_id, tamara_checkout_id, and tamara_status when using TamaraOrderableTrait. Eloquent models can use corresponding database attributes (or their supported dynamic attributes); plain PHP entities should declare all three properties. The SDK checks this before creating a Tamara checkout, so a configuration mistake cannot leave an unrecorded remote session. The checkout currency comes from the order's getTamaraCurrency() method. The Laravel default_locale setting controls the default hosted checkout locale; an explicit locale passed to initiateCheckout() takes precedence.

2. Create Checkout Session

3. Handle Webhooks (Secure & Authenticated)


Framework Integration Examples

Laravel Controller Example

Return the processor's http_status as shown so Tamara can retry failed deliveries. retry is true for a 409 event that is ahead of the stored order status and may become valid later, and a 503 event another worker is still processing. Stale or terminal-state events are acknowledged as 200 and ignored. Status meanings:

HTTP status Meaning
200 Processed, duplicate, or unsupported event acknowledged
400 Malformed webhook payload
401 Missing or invalid webhook token
404 Matching order was not found; delivery can be retried after local order creation
409 Event is ahead of the stored order status and may become valid when earlier events arrive; retry
500 Local webhook handler or persistence failed, or the stored Tamara order status is unrecognised
502 Tamara API/status verification or auto-authorisation failed
503 Another worker holds the short processing lease; retry after it expires or finishes

Advanced API Operations

Authorise approved orders

After receiving order_approved, authorise the order server-side so Tamara can move it to authorised. Enable the processor's opt-in helper when creating it:

The helper calls Tamara's authorise endpoint when an order_approved event is processed. If your account uses Tamara auto-authorisation, leave this disabled.

For capture, $shippingInfo must include shipped_at and shipping_company. tracking_number (string, integer, or null) and tracking_url (string or null) are optional. The method also accepts optional shipping, tax, and discount amounts after $shippingInfo. Tamara cancellation is allowed only while the order is authorised; the SDK checks the remote order status before calling cancel. Canceling the uncaptured remainder after a partial capture is out of scope. Cancel events after capture are treated as stale and acknowledged without changing the local order.

The order builder requires an address by default. For digital services, inject a builder configured with (new TamaraOrderBuilder())->setRequiresShippingAddress(false) into TamaraService. The builder sends zero shipping and tax amounts when the order does not define getTamaraShippingAmount() or getTamaraTaxAmount(). A positive discount is included only when the order defines getTamaraDiscount(), and its payload includes a name. The trait's default item represents the full order amount. If your order has shipping, tax, or a discount, override getTamaraItems() so item totals plus those adjustments match getTamaraAmount(). The optional discount label can be supplied by implementing getTamaraDiscountName(); otherwise the builder uses Discount.

Sandbox verification status

Checkout, approval, and authorisation were exercised against Tamara's sandbox. This account automatically captured the order after authorisation, so manual capture and cancellation have not yet been verified in the sandbox. Webhook payload handling was tested locally; delivery from Tamara to a registered endpoint was not part of that local test.


License

The MIT License (MIT). Please see License File for more information.


All versions of tamara-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-curl Version *
ext-json Version *
psr/log Version ^1.0|^2.0|^3.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 ahmedibrahimyassindev/tamara-php-sdk contains the following files

Loading the files please wait ...