PHPackages                             opentickettech/powertranz-hhp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. opentickettech/powertranz-hhp

ActiveLibrary[Payment Processing](/categories/payments)

opentickettech/powertranz-hhp
=============================

Powertranz gateway for the Omnipay payment processing library

0.0.5(9mo ago)01.3kMITPHPPHP ^7.2 || ^8.0

Since Sep 1Pushed 9mo agoCompare

[ Source](https://github.com/opentickettech/omnipay-powertranz-hhp)[ Packagist](https://packagist.org/packages/opentickettech/powertranz-hhp)[ Docs](https://omnipay.thephpleague.com/)[ RSS](/packages/opentickettech-powertranz-hhp/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependencies (5)Versions (6)Used By (0)

Omnipay: Powertranz
===================

[](#omnipay-powertranz)

**Powertranz gateway driver for the Omnipay PHP payment processing library**

[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Powertranz support for Omnipay.

Installation
------------

[](#installation)

Via Composer:

```
composer require omnipay/powertranz
```

Usage
-----

[](#usage)

### Gateway Initialization

[](#gateway-initialization)

```
use Omnipay\Omnipay;

// Create the gateway
$gateway = Omnipay::create('Powertranz');

// Configure with your credentials
$gateway->setPowertranzId('your-powertranz-id');
$gateway->setPowertranzPassword('your-powertranz-password');
$gateway->setTestMode(true); // Use false for production
```

### Purchase (Payment Initiation)

[](#purchase-payment-initiation)

This creates a payment request and returns an SPI token for the hosted payment page:

```
$response = $gateway->purchase([
    'amount' => '10.00',
    'currency' => 'GTQ', // Supports GTQ, USD, EUR, GBP
    'transactionId' => 'ORDER-123456', // Your unique order reference
    'returnUrl' => 'https://yoursite.com/payment/return',
    'description' => 'Order #123456',
])->send();

if ($response->isRedirect()) {
    // Get the SPI token for the payment
    $spiToken = $response->getSpiToken();

    // Get the transaction reference for future operations
    $transactionRef = $response->getTransactionReference();

    // Redirect to the payment page
    $response->redirect();
} else {
    // Payment initiation failed
    echo $response->getMessage();
}
```

### Complete Purchase (Process Return)

[](#complete-purchase-process-return)

After the customer completes payment and returns to your site:

```
// The SPI token will be in the return URL parameters
$response = $gateway->completePurchase([
    'spiToken' => $_GET['SpiToken'], // Automatically captured from request if not provided
])->send();

if ($response->isSuccessful()) {
    // Payment was successful
    $transactionRef = $response->getTransactionReference();
    $authCode = $response->getAuthorizationCode();
    $maskedCard = $response->getMaskedCard();

    echo "Payment successful! Reference: " . $transactionRef;
} else {
    // Payment failed
    echo "Payment failed: " . $response->getMessage();
}
```

### Fetch Transaction Details

[](#fetch-transaction-details)

Query the status of a transaction:

```
$response = $gateway->fetchTransaction([
    'transactionReference' => 'TXN-123456',
])->send();

if ($response->isSuccessful()) {
    $isPaid = $response->isPaid();
    $amount = $response->getAmount();
    $currency = $response->getCurrency();
    $status = $response->getTransactionStatus();
    $date = $response->getTransactionDate();

    echo "Transaction " . ($isPaid ? "is paid" : "is not paid");
} else {
    echo "Transaction not found: " . $response->getMessage();
}
```

### Refund Transaction

[](#refund-transaction)

Process a full or partial refund:

```
$response = $gateway->refund([
    'transactionReference' => 'TXN-123456',
    'amount' => '5.00', // Partial refund of 5.00
    'currency' => 'GTQ',
])->send();

if ($response->isSuccessful()) {
    $refundRef = $response->getTransactionReference();
    echo "Refund successful! Reference: " . $refundRef;
} else {
    echo "Refund failed: " . $response->getMessage();
}
```

Advanced Configuration
----------------------

[](#advanced-configuration)

### Custom 3D Secure Settings

[](#custom-3d-secure-settings)

```
$response = $gateway->purchase([
    'amount' => '10.00',
    'currency' => 'GTQ',
    'transactionId' => 'ORDER-123456',
    'returnUrl' => 'https://yoursite.com/return',

    // Custom 3D Secure parameters
    'challengeIndicator' => '03', // Challenge preference
    'challengeWindowSize' => 4,    // Window size for challenge
    'authenticationIndicator' => '04', // Authentication type

    // Custom hosted page settings
    'pageName' => 'MyCustomPage',
    'pageSet' => 'PTZ/MyPageSet',
])->send();
```

Currency Support
----------------

[](#currency-support)

The gateway supports **all ISO 4217 currency codes** with automatic numeric code conversion. You can use either the 3-letter ISO code (e.g., 'USD', 'EUR', 'GTQ') or the 3-digit numeric code (e.g., '840', '978', '320').

Common currencies include:

- GTQ (320) - Guatemalan Quetzal
- USD (840) - US Dollar
- EUR (978) - Euro
- GBP (826) - British Pound Sterling
- CAD (124) - Canadian Dollar
- AUD (036) - Australian Dollar
- JPY (392) - Japanese Yen
- CNY (156) - Chinese Yuan
- INR (356) - Indian Rupee
- MXN (484) - Mexican Peso
- BRL (986) - Brazilian Real

The gateway automatically converts ISO currency codes to their numeric equivalents as required by the Powertranz API. All 180+ world currencies are supported.

Testing
-------

[](#testing)

Run the unit tests:

```
composer test
```

Run code style checks:

```
composer check-style
```

Fix code style issues:

```
composer fix-style
```

API Endpoints
-------------

[](#api-endpoints)

The gateway uses the following Powertranz API endpoints:

- **Test Environment**: `https://staging.ptranz.com`
- **Production Environment**: `https://ptranz.com`

### Endpoints Used:

[](#endpoints-used)

- `/Api/Spi/Auth` - Payment initiation (SPI token generation)
- `/Api/spi/Payment` - Complete payment (process SPI token)
- `/Api/refund` - Process refunds
- `/Api/Transactions/{id}` - Fetch transaction details

Response Codes
--------------

[](#response-codes)

Common ISO response codes returned by the gateway:

- `00` - Approved/Success
- `05` - Declined
- `99` - General error/Not found

Security
--------

[](#security)

- Never expose your Powertranz credentials in client-side code
- Always validate the transaction status server-side
- Use HTTPS for all API communications
- Store sensitive transaction data securely

Support
-------

[](#support)

For gateway-specific issues, contact Powertranz support. For library issues, please use the [GitHub issue tracker](https://github.com/omnipay/omnipay-powertranz/issues).

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance57

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

5

Last Release

284d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1905778?v=4)[Chris](/maintainers/Grisgruis)[@Grisgruis](https://github.com/Grisgruis)

---

Tags

paymentgatewaypaymerchantomnipaypurchasepowertranz

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/opentickettech-powertranz-hhp/health.svg)

```
[![Health](https://phpackages.com/badges/opentickettech-powertranz-hhp/health.svg)](https://phpackages.com/packages/opentickettech-powertranz-hhp)
```

###  Alternatives

[lokielse/omnipay-alipay

Alipay gateway for Omnipay payment processing library

557422.8k11](/packages/lokielse-omnipay-alipay)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
