PHPackages                             solinor/paymenthighwayio - 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. solinor/paymenthighwayio

ActiveLibrary[Payment Processing](/categories/payments)

solinor/paymenthighwayio
========================

Paymenthighway SDK

3.0.0(6y ago)595.6k↓50%4[2 PRs](https://github.com/PaymentHighway/paymenthighway-php-lib/pulls)1MITPHPPHP &gt;=5.6.0CI failing

Since Feb 11Pushed 5y ago13 watchersCompare

[ Source](https://github.com/PaymentHighway/paymenthighway-php-lib)[ Packagist](https://packagist.org/packages/solinor/paymenthighwayio)[ Docs](https://paymenthighway.fi/dev/)[ RSS](/packages/solinor-paymenthighwayio/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (21)Used By (1)

PaymentHighway PHP SDK
======================

[](#paymenthighway-php-sdk)

[![](https://camo.githubusercontent.com/c6754c8bcaad788fda42e6020f07f4a7d7a6bcfb5e373ddbbfb89a517f61cbd6/68747470733a2f2f7472617669732d63692e6f72672f5061796d656e74486967687761792f7061796d656e74686967687761792d7068702d6c69622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PaymentHighway/paymenthighway-php-lib)

This library is being **Deprecated**, and won't get new features.

Requirements
------------

[](#requirements)

- PHP 5.6.+
- Composer

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

[](#installation)

add following to composer

```
    "require" :
    {
        "solinor/paymenthighwayio" : "2.0.0"
    }
```

Structure
---------

[](#structure)

- `\Solinor\PaymentHighway`

Contains API methods. Use these to create Payment Highway API requests.

- `\Solinor\PaymentHihgway\Model`

Contains Models used to inject paymentApi requests.

- `\Solinor\PaymentHihgway\Security`

Contains classes used for hash calculations

Overview
========

[](#overview)

Start with building the HTTP form parameters by using the FormParameterBuilder. Create an instance of the builder, then use the generate methods to receive a list of parameters for each API call.

### Initializing the builder

[](#initializing-the-builder)

```
use \Solinor\PaymentHighway\FormBuilder;

$method = "POST";
$signatureKeyId = "testKey";
$signatureSecret = "testSecret";
$account = "test";
$merchant = "test_merchantId";
$baseUrl = "https://v1-hub-staging.sph-test-solinor.com";
$successUrl = "https://example.com/success";
$failureUrl = "https://example.com/failure";
$cancelUrl = "https://example.com/cancel";
$language = "EN";

$formBuilder = new FormBuilder($method, $signatureKeyId, $signatureSecret, $account,
                              $merchant, $baseUrl, $successUrl, $failureUrl,
                              $cancelUrl, $language);
```

### Example generateAddCardParameters

[](#example-generateaddcardparameters)

```
$form = $formBuilder->generateAddCardParameters($accept_cvc_required = false);
```

For all Form objects returned by FormBuilder methods

```
// read form parameters
$httpMethod = $form->getMethod();
$actionUrl = $form->getAction();
$parameters = $form->getParameters();

// Header parameters as key => value array
foreach ($parameters as $key => $value) {
	echo $key .":". $value;
}
```

### Example generatePaymentParameters

[](#example-generatepaymentparameters)

```
$amount = "1990";
$currency = "EUR";
$orderId = "1000123A";
$description = "A Box of Dreams. 19,90€";

$form = $formBuilder->generatePaymentParameters($amount, $currency, $orderId, $description);
```

### Example generateGetAddCardAndPaymentParameters

[](#example-generategetaddcardandpaymentparameters)

```
$amount = "1990";
$currency = "EUR";
$orderId = "1000123A";
$description = "A Box of Dreams. 19,90€";

$form = $formBuilder->generateAddCardAndPaymentParameters($amount, $currency, $orderId, $description);
```

### Example generatePayWithMobilePayParameters with optional parameters

[](#example-generatepaywithmobilepayparameters-with-optional-parameters)

```
$amount = "1990";
$currency = "EUR";
$orderId = "1000123A";
$description = "A Box of Dreams. 19,90€";
$exitIframeOnResult = null;
$shopLogoUrl = "https://foo.bar/biz.png";
$phoneNumber = "+3581234567";
$shopName = "Jaskan solki";

$form = $formBuilder->generatePayWithMobilePayParameters(
		$amount,
		$currency,
		$orderId,
		$description,
		$exitIframeOnResult,
		$shopLogoUrl,
		$phoneNumber,
		$shopName
	);
```

##### About shop logo in MobilePay

[](#about-shop-logo-in-mobilepay)

- The logo must be 250x250 pixel in .png format.
- MPO will show a default logo in the app if this is empty or the image location doesn’t exist.
- Once a ShopLogoURL has been sent to MPOnline the .png-file on that URL must never be changed. If the shop wants a new (or more than one) logo, a new ShopLogoURL must be used.
- The logo must be hosted on a HTTPS (secure) server.

### Example validateFormRedirect

[](#example-validateformredirect)

```
use Solinor\PaymentHighway\Security\SecureSigner;

$secureSigner = new SecureSigner(signatureKeyId, signatureSecret);

try{
    $secureSigner->validateFormRedirect($params) // redirected get params as [ key => value] array
}
catch(Exception $e) {
    // Validation failed, handle here
}
```

PaymentApi
----------

[](#paymentapi)

In order to do safe transactions, an execution model is used where the first call to /transaction acquires a financial transaction handle, later referred as “ID”, which ensures the transaction is executed exactly once. Afterwards it is possible to execute a debit transaction by using the received id handle. If the execution fails, the command can be repeated in order to confirm the transaction with the particular id has been processed. After executing the command, the status of the transaction can be checked by executing the `PaymentAPI->statusTransaction( $transactionId )` request.

In order to be sure that a tokenized card is valid and is able to process payment transactions the corresponding tokenization id must be used to get the actual card token.

### Remember to check the result code:

[](#remember-to-check-the-result-code)

```
$response->body->result->code
```

Code 100 means "Request successful". Other response codes can be found:

### Initializing the Payment API

[](#initializing-the-payment-api)

```
use Solinor\PaymentHighway\PaymentApi;

$serviceUrl = "https://v1-hub-staging.sph-test-solinor.com";
$signatureKeyId = "testKey";
$signatureSecret = "testSecret";
$account = "test";
$merchant = "test_merchantId";

$paymentApi = new PaymentApi($serviceUrl, $signatureKeyId, $signatureSecret, $account, $merchant);
```

### Example Commit Form Transaction

[](#example-commit-form-transaction)

```
$transactionId = "f23a9be0-15fe-43df-98ac-92f6a5731c3b"; // get sph-transaction-id as a GET parameter
$amount = 1999;
$currency = "EUR";

$response = $paymentApi->commitFormTransaction($transactionId, $amount, $currency ); //response is pure json run through json_decode();
```

### Example Tokenize (get the actual card token by using token id)

[](#example-tokenize-get-the-actual-card-token-by-using-token-id)

```
$response = $paymentApi->tokenize( $tokenizationId );
```

### Example Init transaction

[](#example-init-transaction)

```
$response = $paymentApi->initTransaction();
```

### Example Debit with Token

[](#example-debit-with-token)

NOTE: The `debitTransaction` method will be deprecated starting from Sep 14th 2019 in favor of the new `chargeCustomerInitiatedTransaction` and `chargeMerchantInitiatedTransaction` in order to comply with the EU's PSD2 directive.

```
$token = new \Solinor\PaymentHighway\Model\Token( $tokenId );

$transaction = new \Solinor\PaymentHighway\Model\Request\Transaction( $token, $amount, $currency );

$response = $paymentApi->debitTransaction( $transactionId, $transaction);
```

### Charging a card

[](#charging-a-card)

After the introduction of the European PSD2 directive the electronic payment transactions are categorised in so called customer initiated transactions (CIT) and merchant initiated transactions (MIT).

Customer initiated transactions are scenarios where the customer takes actively part in the payment process either by providing their card information or selecting a previously stored payment method. Also so-called "one-click" purchases where the transaction uses a previously saved default payment method are CITs.

Merchant initated transactions are transactions which are initated by the merchant without customer's participation. Merchant initated transactions require a prior agreement between the customer and merchant also called the "mandate". Merchant initiated transactions can be used for example in scenarios where the final price is not known at the time of the purchase or the customer is not present when the charge is made.

#### Charging a customer initiated transaction (CIT)

[](#charging-a-customer-initiated-transaction-cit)

When charging a customer initiated transaction there is always a possibility that the card issuer requires strong customer authentication. In case the issuer requests SCA then the response will contain "soft decline" code 400 and an URL where the customer needs to be redirected to perform authentication. The URLs where the customer will be redirected after completing authentication need to be defined in the [`ReturnUrls`](/src/Model/Sca/ReturnUrls.php) object.

In addition to the return urls the [`StrongCustomerAuthentication`](/src/Model/Sca/StrongCustomerAuthentication.php) object has many optional fields for information about the customer and the transaction. This information is used in transaction risk analysis (TRA) and can increase the likelihood that the transaction is considered low risk so that strong customer authentication is not needed.

```
$token = new \Solinor\PaymentHighway\Model\Token( $tokenId );

$strongCustomerAuthentication = new \Solinor\PaymentHighway\Model\Sca\StrongCustomerAuthentication(
	new \Solinor\PaymentHighway\Model\Sca\ReturnUrls(
		"https://example.com/success", // URL the user is redirected after succesful 3D-Secure authentication if strong customer authentication is required
		"https://example.com/cancel", // URL the user is redirected after cancelled 3D-Secure authentication if strong customer authentication is required
		"https://example.com/failure" // URL the user is redirected after failed 3D-Secure authentication if strong customer authentication is required
	)
	// Optinally other information about the customer and purchase to help in transaction risk analysis (TRA)
);

$transaction = new \Solinor\PaymentHighway\Model\Request\CustomerInitiatedTransaction( $token, $amount, $currency, $strongCustomerAuthentication );

$response = $paymentApi->chargeCustomerInitiatedTransaction( $transactionId, $transaction);
```

#### Charging a merchant initiated transaction (MIT)

[](#charging-a-merchant-initiated-transaction-mit)

When charging the customer's card in context where the customer is not actively participating in the transaction you should use the `chargeMerchantInitiatedTransaction` method. The MIT transactions are exempt from the strong customer authentication requirements of PSD2 so the request cannot be answered with "soft-decline" response (code 400) unlike customer initated transactions.

```
$token = new \Solinor\PaymentHighway\Model\Token( $tokenId );

$transaction = new \Solinor\PaymentHighway\Model\Request\Transaction( $token, $amount, $currency );

$response = $paymentApi->chargeMerchantInitiatedTransaction( $transactionId, $transaction);
```

### Example Revert

[](#example-revert)

```
$response = $paymentApi->revertTransaction("transactionId", "amount");
```

### Example Transaction Status

[](#example-transaction-status)

```
$status = $paymentApi->statusTransaction( $transactionId );
```

### Example Daily Batch Report

[](#example-daily-batch-report)

```
$response = $paymentApi->getReport( $date ); //in "date('Y-M-D')" format
```

### Example Order Status

[](#example-order-status)

```
$response = $paymentApi->searchByOrderId( $orderId );
```

Errors
======

[](#errors)

Payment Highway API can raises exceptions and you should handle them in graceful manner.

```
try {
	// Use Payment Highway's bindings...
}
catch (Exception $e) {
  	// Something else happened
}
```

Help us make it better
======================

[](#help-us-make-it-better)

Please tell us how we can make the API better. If you have a specific feature request or if you found a bug, please use GitHub issues. Fork these docs and send a pull request with improvements.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 78.2% of commits — single point of failure

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 ~85 days

Recently: every ~57 days

Total

19

Last Release

2205d ago

Major Versions

1.9.0 → 2.0.02020-04-21

2.0.0 → 3.0.02020-05-05

PHP version history (2 changes)1.0.0-RC1PHP &gt;=5.4.0

1.5.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e912fb16bb52921653948bc97c32cad7d62d770aeb1a4d038b594445abd85f1?d=identicon)[ArnoHietanen](/maintainers/ArnoHietanen)

---

Top Contributors

[![Kostersson](https://avatars.githubusercontent.com/u/5220255?v=4)](https://github.com/Kostersson "Kostersson (97 commits)")[![jonni-larjomaa](https://avatars.githubusercontent.com/u/1671576?v=4)](https://github.com/jonni-larjomaa "jonni-larjomaa (14 commits)")[![Swie](https://avatars.githubusercontent.com/u/2796668?v=4)](https://github.com/Swie "Swie (8 commits)")[![margussipria](https://avatars.githubusercontent.com/u/415246?v=4)](https://github.com/margussipria "margussipria (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/solinor-paymenthighwayio/health.svg)

```
[![Health](https://phpackages.com/badges/solinor-paymenthighwayio/health.svg)](https://phpackages.com/packages/solinor-paymenthighwayio)
```

###  Alternatives

[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[wandesnet/mercadopago-laravel

PHP SDK for integration with Mercado Pago

252.4k](/packages/wandesnet-mercadopago-laravel)[messagecloud/gateway-php

A PHP library to help you integrate the MessageCloud Gateway.

137.2k](/packages/messagecloud-gateway-php)[mabiola/paystack-php-lib

A PHP Library for https://paystack.co

262.0k](/packages/mabiola-paystack-php-lib)

PHPackages © 2026

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