PHPackages                             spyrit/smoney - 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. [API Development](/categories/api)
4. /
5. spyrit/smoney

ActiveLibrary[API Development](/categories/api)

spyrit/smoney
=============

Smoney client

03.9k3PHP

Since Aug 29Pushed 5y ago3 watchersCompare

[ Source](https://github.com/spyrit/S-money-API-Client-PHP-1)[ Packagist](https://packagist.org/packages/spyrit/smoney)[ RSS](/packages/spyrit-smoney/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

S-Money library
===============

[](#s-money-library)

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

[](#installation)

```
composer install

```

Usage
-----

[](#usage)

The S-Money API can be consumed using REST services.

### Architecture

[](#architecture)

This library provides an implementation for these services, based on GuzzleHttp and JMS Serializer. In order to consume a webservice, one must first create a client object and a resource facade containing the data to send to the API.

Each client will return an updated facade object with the data returned by the webserice.

### Configuration

[](#configuration)

A client must be provided with the API url, your secret token and the version of the API to use (see the official documentation in order to determine the correct version for each webservice).

The version can be defined in the constructor and optionnaly overridden using the `setVersion` method:

```
$client->setVersion('v1');
```

Examples
--------

[](#examples)

### User

[](#user)

```
$token = '';
$version = 'v1';
$userClient = new UserClient(
    'https://rest-pp.s-money.fr/api/sandbox',
    $token,
    $version,
    new GuzzleHttp\Client(),
    JMS\Serializer\SerializerBuilder::create()->build()
);
```

#### Create Simple User

[](#create-simple-user)

To create simple user and its attributes:

```
$user = new UserFacade();
$user->appUserId = 'ALFRED';

/* Then, more complex attributes */

/* profile attribute */
$user->profile = new UserProfileFacade();
$user->profile->firstName = 'toto';
$user->profile->lastName = 'foo';
$user->profile->birthdate = new DateTime('1989-08-02T00:00:00', new DateTimeZone('Europe/Paris'));

/* address attribute which is UserFacade::$profile attribute */
$user->profile->address = new AddressFacade();
$user->profile->address->country = 'US';

/* Then we POST the $user */
$userClient->create($user);
```

#### Business User

[](#business-user)

You only need to set the `type` attribute of the 'UserFacade' to `2` and the set `company` attribute with `name` and `siret`:

```
$user = new UserFacade();
//...
$user->type = 2;
$user->company = new CompanyFacade();
$user->company->name = 'HELLO LTD';
$user->company->siret = 'XXXXXXXX';

$userClient->create($user);
```

### CardPayment

[](#cardpayment)

```
$cardPaymentClient = new CardPaymentClient(
    'https://rest-pp.s-money.fr/api/sandbox',
    $token,
    $version,
    new Client(),
    SerializerBuilder::create()->build()
);
```

#### Simple Payment

[](#simple-payment)

```
$cardPayment = new CardPaymentFacade();

$cardPayment->urlReturn = 'http://callback_after_payment.com';
$cardPayment->amount = 2;
$cardPayment->beneficiary = new SubAccountRefFacade();
$cardPayment->beneficiary->appAccountId = 'client-112';

$cardPaymentClient->create($appUserId, $cardPayment);
```

#### Multiple beneficiaries

[](#multiple-beneficiaries)

Use API v2 for this service.

```
$cardPayment = new CardPaymentFacade();
$cardPayment->urlReturn = 'http://callback_after_payment.com';
$cardPayment->payments = new ArrayCollection();

$first = new PaymentFacade();
$first->beneficiary = new subAccountFacade();
$first->beneficiary->appAccountId = 'ALFRED';
$first->amount = 1500; // 15€ (amount in cents)

$cardPayment->payments->add($first);

$second = new PaymentFacade;
//...
$cardPayment->payments->add($second);

$cardPaymentClient->create($cardPayment);
```

#### Get one CardPayment by id

[](#get-one-cardpayment-by-id)

```
$cardPaymentClient->get($orderId);
```

#### List all CardPayments

[](#list-all-cardpayments)

```
$cardPaymentClient->index();
```

### Payout

[](#payout)

```
$payoutClient = new PayoutClient(
    'https://rest-pp.s-money.fr/api/sandbox',
    $token,
    $version,
    new Client(),
    SerializerBuilder::create()->build()
);
```

#### Create Payout

[](#create-payout)

```
$payout = new PayoutFacade();
$payout->orderId = 'hello';
$payout->amount = 99;
$payout->bankAccount = new BankAccountFacade;
$payout->bankAccount->id = 25923;

$payoutClient->create('', $payout);
```

### Payment

[](#payment)

```
$paymentClient = new PaymentClient(
    'https://rest-pp.s-money.fr/api/sandbox',
    $token,
    $version,
    new Client(),
    SerializerBuilder::create()->build()
);
```

#### Create Payment

[](#create-payment)

```
$payment = new PaymentFacade();
$payment->beneficiary = new SubAccountRefFacade();
$payment->beneficiary->appAccountId = 'YOUR PAL';
$payment->sender = new SubAccountRefFacade();
$payment->sender->appAccountId = 'ALFRED';
$payment->amount = 99;

$paymentClient->create('', $payment);
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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/22ef5c808b13d78c94fd3d55407740ca250bb116263cb0be3ad1c2e6f26d117f?d=identicon)[Spyrit\_SI](/maintainers/Spyrit_SI)

---

Top Contributors

[![juchi](https://avatars.githubusercontent.com/u/3333098?v=4)](https://github.com/juchi "juchi (10 commits)")[![pyguerder](https://avatars.githubusercontent.com/u/6534215?v=4)](https://github.com/pyguerder "pyguerder (9 commits)")[![Patrice972](https://avatars.githubusercontent.com/u/25589896?v=4)](https://github.com/Patrice972 "Patrice972 (4 commits)")[![maillardmartin](https://avatars.githubusercontent.com/u/10208806?v=4)](https://github.com/maillardmartin "maillardmartin (3 commits)")[![Leobaillard](https://avatars.githubusercontent.com/u/402250?v=4)](https://github.com/Leobaillard "Leobaillard (2 commits)")

### Embed Badge

![Health badge](/badges/spyrit-smoney/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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