PHPackages                             steffenz/php-nets-sdk - 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. steffenz/php-nets-sdk

ActiveSdk[Payment Processing](/categories/payments)

steffenz/php-nets-sdk
=====================

Unofficial PHP SDK to make it easy to interact with Nets (nordic payment provider) API.

071PHP

Since May 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/steffenz/php-nets-sdk)[ Packagist](https://packagist.org/packages/steffenz/php-nets-sdk)[ RSS](/packages/steffenz-php-nets-sdk/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Unoffical PHP SDK for Nets 💸
============================

[](#unoffical-php-sdk-for-nets-)

This is a super unoffical (but offically awesome) SDK that makes payments easy as stealing candy from a baby. And let's be honest, we are all just kids that wants candy 🍭

This plan is to launch this as a composer package, so stay tuned for that to happen 🚚

Something broken, or not working as expected? Feel free to contribute and submit a PR 🥰

Getting started
---------------

[](#getting-started)

### Creating a new transaction

[](#creating-a-new-transaction)

Before you can capture some precious dough, you need to create and register a transaction. We won't cover error handling in this example, but you should wrap this code in a try/catch block (there is a lot of things that can go wrong).

```
use NetsSdk\Merchant;
use NetsSdk\Currencies;
use NetsSdk\Price;
use NetsSdk\Request;
use NetsSdk\Transaction;

/* Create a new merchant object with your credentials. */
$merchant = new Merchant();
$merchant->setMerchantId("")
         ->setAccessToken("");

/* Create a new price object with your desired currency. */
$price = new Price();
$price->setAmount(13.37)
      ->setCurrency(Currencies::NorwegianKrone)

/* Create new request object */
$request = new Request();
$request->setOrderNumber(1337)
        ->setPrice($price)
        ->setCustomerFirstName("Nitrus")
        ->setCustomerLastName("Brio")
        ->setCustomerEmail("nitrus.cheezedoodles91@hotmail.com")
        ->setOrderDescription("Equipment for cortex vortex.")
        ->setRedirectUrl("http://localhost/cash4life");

/* Create and register new transaction */
$transaction = new Transaction();
$transaction->setMerchant($merchant)
            ->setRequest($requestObj)
            ->setIsTestEnvironment(true) // Uses Nets test enviroment.
            ->register(); // Posts to Nets API.

/* Retrives the transaction ID */
$transactionId = $transaction->getTransactionId();

/* URL to terminal */
$terminalUrl = $transaction->getTerminalUrl();
```

### Authorizing and capturing the payment

[](#authorizing-and-capturing-the-payment)

The most exiting part. In the previous step we just purchased the tickets; now it's time to grab some cash (or at the very least some bits and bytes). We'll assume you "lost" the object from the previous block, and simply query it from the API when we need it.

Again, you should wrap this in try/catch. We double check if the transaction is authorized and/or captured to avoid spamming the API which in turn logs this attempts.

```
use NetsSdk\Merchant;
use NetsSdk\Transaction;

/* Passing to the constructor, just to make it less readable */
$merchant = new Merchant("merchantId", "accessToken");

/* We don't need a request this time */
$request = false;

/* Still testing, aren't we? */
$isTestEnvironment = true;

/* Creating a new transaction with a known ID */
$transaction = new Transaction($merchant, false, $transactionId, $isTestEnvironment);
$isAuthorized = $transaction->isAuthorized();

/* Authorize transaction if it hasn't been done already */
if(!$transaction->isAuthorized()){
    $transaction->authorize();
}

/* If nothing is captured - we'll capture too */
if($transaction->getCapturedAmount() < 1){
    $transaction->capture();
}

/* Fetch the full transaction object */
$transaction = $transaction->query();
```

Useful resources
----------------

[](#useful-resources)

[https://www.youtube.com/watch?v=ewRjZoRtu0Y&amp;t=56](https://www.youtube.com/watch?v=ewRjZoRtu0Y&t=56)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/148fd4eab3895009b18f94a0051343e899a797cfbaf85a496f8f0f562a8d11da?d=identicon)[steffenz](/maintainers/steffenz)

---

Top Contributors

[![steffenz](https://avatars.githubusercontent.com/u/1404818?v=4)](https://github.com/steffenz "steffenz (11 commits)")

---

Tags

paymentsphpsdk

### Embed Badge

![Health badge](/badges/steffenz-php-nets-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/steffenz-php-nets-sdk/health.svg)](https://phpackages.com/packages/steffenz-php-nets-sdk)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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