PHPackages                             consilience/starling-payments-objects - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. consilience/starling-payments-objects

ActiveLibrary[HTTP &amp; Networking](/categories/http)

consilience/starling-payments-objects
=====================================

Starling Bank Payments Service data objects

2.0.0(3y ago)44091[9 issues](https://github.com/ardohr-ltd/starling-payments-objects/issues)[1 PRs](https://github.com/ardohr-ltd/starling-payments-objects/pulls)MITPHPPHP &gt;=8.1

Since Feb 15Pushed 3y ago2 watchersCompare

[ Source](https://github.com/ardohr-ltd/starling-payments-objects)[ Packagist](https://packagist.org/packages/consilience/starling-payments-objects)[ Docs](https://github.com/consilience)[ RSS](/packages/consilience-starling-payments-objects/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (6)Versions (21)Used By (0)

[![Build Status](https://camo.githubusercontent.com/bb7b3a4c99936f947eaafe366cb67adc64d7bc02e9f02efccae3d9911f43148f/68747470733a2f2f7472617669732d63692e6f72672f636f6e73696c69656e63652f737461726c696e672d7061796d656e74732d6f626a656374732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/consilience/starling-payments-objects)[![Latest Stable Version](https://camo.githubusercontent.com/bb4aa6b0d71befe55d2a484b57a9c100979bcedf2446390ba3943a6532a38866/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696c69656e63652f737461726c696e672d7061796d656e74732d6f626a656374732f762f737461626c65)](https://packagist.org/packages/consilience/starling-payments-objects)[![Total Downloads](https://camo.githubusercontent.com/a28168b909470a41f3e6a7b9f4ceda01bd3f834998910f463b61f5a9be15769a/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696c69656e63652f737461726c696e672d7061796d656e74732d6f626a656374732f646f776e6c6f616473)](https://packagist.org/packages/consilience/starling-payments-objects)[![Latest Unstable Version](https://camo.githubusercontent.com/d4985b9fbec3a5ef3189c428f91e8ba812952a39105402493f21da05d6fbfdb9/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696c69656e63652f737461726c696e672d7061796d656e74732d6f626a656374732f762f756e737461626c65)](https://packagist.org/packages/consilience/starling-payments-objects)[![License](https://camo.githubusercontent.com/89717cb0a1c0ea039e1cdab1b88be4f195ee836d14651cf762afd1c1d544afa4/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696c69656e63652f737461726c696e672d7061796d656e74732d6f626a656374732f6c6963656e7365)](https://packagist.org/packages/consilience/starling-payments-objects)

Starling Bank Payments API Objects
----------------------------------

[](#starling-bank-payments-api-objects)

This is a package for PHP 8.1 to stuff the response body messages from requests to the [Starling Payments API](https://developer.starlingbank.com/payments/docs#operations-tag-Web_Hook)

This package is in development, and has initially covered just the response messages I am particularly interested in. Objects to generate the request message bodies are being added now. The intention is to extend that to include the full PSR-7 message (body, headers, relative path). To support path generation, the contextual UUIDs (e.g. account ID when creating an account address) may need to be added, so the constructors will change.

Additional objects can be submitted by Pull Request if they are something you would like to see.

The request messages are not included in this package for the moment, but they may be in due course. Again, I am happy to accept PRs to hurry this along.

### The Approach

[](#the-approach)

The [Starling Payments API](https://developer.starlingbank.com/payments/docs#operations-tag-Web_Hook)uses JSON request and response bodies. The JSON responses will decode to nested arrays of scalar values. This package provides classes that instantiate objects from that data.

To start with, the classes are just dumb value objects that take the data in properties. Over time, more logic will be added to the classes to interpret the property values in a higher business sense. In addition, the values will be parsed into more common objects such as [Money](http://moneyphp.org) and [Carbon](http://carbon.nesbot.com/docs/)to provide further leverage with the tools and support those libraries come with.

### Simple Example

[](#simple-example)

The [Previous Payments](https://developer.starlingbank.com/payments/docs)API can be used to fetch a single payment from an account address through this endpoint:

```
/api/v1/{paymentBusinessUid}/account/{accountUid}/address/{addressUid}/payment/{paymentUid}

```

This returns a data structure similar to this example:

```
{
  "paymentBusinessUid": "e43d3060-2c83-4bb9-ac8c-c627b9c45f8b",
  "paymentAccountUid": "5347699b-d205-4272-aac6-ee9d7f2dddcf",
  "addressUid": "c0cee51b-700b-481d-8ac5-e2cd75929ef1",
  "paymentUid": "a4edcefd-97b5-46fc-9e79-004fe8f171b7",
  "sourceAccount": {
    "sortCode": "040050",
    "accountNumber": "12345678",
    "bic": "SRLGGB2L",
    "iban": "GB29NWBK60161331926819",
    "accountName": "Bobby Tables"
  },
  "destinationAccount": {
    "sortCode": "040050",
    "accountNumber": "12345678",
    "bic": "SRLGGB2L",
    "iban": "GB29NWBK60161331926819",
    "accountName": "Bobby Tables"
  },
  "direction": "INBOUND",
  "settlementAmount": {
    "currency": "GBP",
    "minorUnits": 11223344
  },
  "instructedAmount": {
    "currency": "GBP",
    "minorUnits": 11223344
  },
  "reference": "ABCD123456",
  "status": "ACCEPTED",
  "rejectedReason": {
    "code": "1234",
    "description": "Beneficiary Sort Code/Account Number unknown"
  },
  "requestedAt": "2017-06-05T11:47:58.801Z",
  "returnDetails": {
    "paymentBeingReturned": "954cbfb3-0de0-4f62-8043-00c5ccee0f12",
    "code": "1234",
    "description": "Beneficiary Sort Code/Account Number unknown"
  },
  "type": "SIP",
  "settlementCycleUid": "bba786ce-3580-4576-9cad-28a6b8f1b228",
  "fpsSettlementCycleId": "CYCLE_001",
  "fpsSettlementDate": "2017-06-05"
}
```

Given that data structure as `$data`, the value object can be instantiated like this:

```
use Consilience\Starling\Payments\Response\PaymentDetails;

$paymentDetails = PaymentDetails::fromArray($data);

// or

$paymentDetails = new PaymentDetails($data);

// or

$paymentDetails = PaymentDetails::fromResponse($psr7response);
```

Each property can then be referenced in a number of ways:

```
$status = $paymentDetails->status;

// or

$status = $paymentDetails->getProperty('status');
```

The nested data will in turn be instantiated as value objects:

```
$instructedCurrency = $paymentDetails->instructedAmount->currency;
```

The `instructedAmount` will be a `CurrencyAndAmount` value object. That object supports conversion to `Money\Money`:

```
$money = $paymentDetails->instructedAmount->toMoney();
var_dump($money);

/*
object(Money\Money)#28 (2) {
  ["amount":"Money\Money":private]=>
  string(3) "999"
  ["currency":"Money\Money":private]=>
  object(Money\Currency)#29 (1) {
    ["code":"Money\Currency":private]=>
    string(3) "GBP"
  }
}
*/
```

Other objects will have similar conversions. For example, the date and datetime properties can be fetched by appending the name with `Carbon` to return a `Carbon` object for the date. For example:

```
var_dump($paymentDetails->fpsSettlementDate);

/*
string(10) "2018-01-05"
*/

var_dump($paymentDetails->fpsSettlementDateCarbon);

/*
object(Carbon\Carbon)#32 (3) {
  ["date"]=>
  string(26) "2018-01-05 00:00:00.000000"
  ["timezone_type"]=>
  int(3)
  ["timezone"]=>
  string(3) "UTC"
}
*/
```

Datetime objects (i.e. timestamps) will be in the timezone they were supplied in. Date objects (without a time) will be returned in the UTC timezone.

That's kind of the wqay it's going, and progress will be documented here as it happens.

Supported Messages
------------------

[](#supported-messages)

All request messages have namespace `Consilience\Starling\Payments\Request`.

All response messages have namespace `Consilience\Starling\Payments\Response`.

The following table lists the requests you can send, and the object to hold the response.

RequestResponseCreatePaymentAccountCreatePaymentAccountResponseCreatePaymentAccountAddressCreatePaymentAccountAddressResponseCreatePaymentDomesticDomesticPaymentInstructionResponseCreatePaymentReturnPaymentReturnResponseGetPaymentPaymentDetailsGetPaymentAccountPaymentAccountGetPaymentAccountAddressPaymentAccountAddressGetPaymentAccountAddressesPaymentAccountAddressCollectionGetPaymentAccountsPaymentAccountCollectionGetPaymentServiceBusinessBusinessInformationGetPaymentsPaymentDetailsCollectionGetSettlementCycleSettlementCycleGetSettlementCycleCurrentSettlementCycleGetSettlementCycleLastSettlementCycleGetSettlementCyclePaymentsPaymentDetailsCollectionUpdatePaymentAccountAddressStatusChangeStatusPaymentAccountAddressResponseGetDirectDebitMandateDirectDebitMandateGetDirectDebitMandatesDirectDebitMandateCollectionActivateMandateRequestActivateMandateResponseCancelMandateRequestCancelMandateResponseTBCPaymentOriginatingOverseasInstructionResponseTo create a response object, you can instantiate it with either the response body data, or the reponse PSR-7 message. For example:

```
use Consilience\Starling\Payments\Request\Models\Endpoint;
use Consilience\Starling\Payments\Request\GetPaymentServiceBusiness;
use Consilience\Starling\Payments\Response\BusinessInformation;

$endpoint = new Endpoint($myPaymentBusinessUid, Endpoint::INSTANCE_SANDBOX);
$message = new GetPaymentServiceBusiness($endpoint);

// $client is created to accept and send PSR-7 requests.
// Note also the client must use a signing provider suitable for
// the Starling Payments API.
$response = $client->send($message->getRequest());

// Create the response object from the HTTP respinse:
$responseObject = BusinessInformation::fromResponse($response);

var_dump($responseObject);

/*
object(Consilience\Starling\Payments\Response\BusinessInformation)#235 (4) {
  ["paymentBusinessUid":protected]=>
  string(36) "4b5de5aa-7752-21ea-8219-2f948454a2d1"
  ["name":protected]=>
  string(14) "My Business Name"
  ["netSenderCap":protected]=>
  object(Consilience\Starling\Payments\Response\Models\CurrencyAndAmount)#232 (3) {
    ["currency":protected]=>
    string(3) "GBP"
    ["minorUnits":protected]=>
    int(10000)
  }
}
*/
```

Building the request objects may include any of the following classes in `Consilience\Starling\Payments\Request\Models`:

- CreatePaymentAccountAddressRequest
- CreatePaymentAccountRequest
- CurrencyAndAmount
- DomesticInstructionAccount
- DomesticPaymentInstructionRequest
- Endpoint
- PaymentReturnRequest

The response messages may contain the following lower-level models:

- Response\\Models\\AccountNumberAndSortCode
- Response\\Models\\CurrencyAndAmount
- Response\\Models\\PaymentDetailsAccount
- Response\\Models\\PaymentReturnDetails
- Response\\Models\\Balance
- Response\\Models\\ErrorDetail
- Response\\Models\\PaymentRejectionReason

Webhooks are supported:

- ServerRequest\\FpsSchemeNotification
- ServerRequest\\FpsInboundNotification
- ServerRequest\\FpsRedirectionNotification
- ServerRequest\\FpsReversalNotification (no tests yet)
- ServerRequest\\AccountTransactionNotification (no tests yet)
- ServerRequest\\MandateCreatedNotification
- ServerRequest\\MandateCancelledNotification
- ServerRequest\\MandateOriginatorChangedNotification
- ServerRequest\\DirectCreditPaymentReceivedNotification
- ServerRequest\\DirectDebitPaymentPaidNotification
- ServerRequest\\DirectDebitPaymentRejectedNotification

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 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.

###  Release Activity

Cadence

Every ~112 days

Recently: every ~127 days

Total

15

Last Release

1434d ago

Major Versions

0.8.1 → 1.0.02018-04-27

0.10.0 → 1.1.12020-02-27

1.2.3 → 2.0.02022-06-06

PHP version history (3 changes)0.8.0PHP &gt;=5.6.0

1.2.0PHP &gt;=7.1.0

2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/395934?v=4)[Jason Judge](/maintainers/judgej)[@judgej](https://github.com/judgej)

---

Top Contributors

[![judgej](https://avatars.githubusercontent.com/u/395934?v=4)](https://github.com/judgej "judgej (93 commits)")

---

Tags

apibankbicfintechibanpaymentsphpstarlingGuzzleauthfintechstarling

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/consilience-starling-payments-objects/health.svg)

```
[![Health](https://phpackages.com/badges/consilience-starling-payments-objects/health.svg)](https://phpackages.com/packages/consilience-starling-payments-objects)
```

###  Alternatives

[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[kevinrob/guzzle-cache-middleware

A HTTP/1.1 Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack. (RFC 7234)

43117.4M104](/packages/kevinrob-guzzle-cache-middleware)[eightpoints/guzzle-bundle

Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony. Comes with easy and powerful configuration options and optional plugins.

45912.1M55](/packages/eightpoints-guzzle-bundle)[guzzlehttp/oauth-subscriber

Guzzle OAuth 1.0 subscriber

24114.5M141](/packages/guzzlehttp-oauth-subscriber)[graham-campbell/guzzle-factory

Provides A Simple Guzzle Factory With Good Defaults

916.4M49](/packages/graham-campbell-guzzle-factory)[gmponos/guzzle_logger

A Guzzle middleware to log request and responses automatically

772.2M6](/packages/gmponos-guzzle-logger)

PHPackages © 2026

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