assoconnect / smoney-client
PHP client for S-Money API
Installs: 12 033
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 11
Forks: 1
Open Issues: 3
Requires
- php: ^7.4|^8.0
- fig/http-message-util: ^1.1
- guzzlehttp/guzzle: ^6.3|^7.0
- guzzlehttp/psr7: ^1.5
- koriym/http-constants: ^1.1
Requires (Dev)
- phpunit/phpunit: ^9.0
- dev-master
- v5.1.3
- v5.1.2
- v5.1.1
- v5.1.0
- v5.0.0
- v4.4.2
- v4.4.1
- v4.4.0
- v4.3.0
- v4.2.1
- v4.2.0
- v4.1.0
- v4.0.2
- v4.0.1
- v4.0.0
- v3.0.0
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v2.0.0-alpha
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0
- dev-dependabot/composer/guzzlehttp/psr7-1.9.1
- dev-dependabot/composer/guzzlehttp/guzzle-7.4.4
- dev-template
- dev-feature_sylvain_user_role
- dev-fix_sepa_payment_manager_2
- dev-feature_sylvain_signature
- dev-feature_sepa_tests
- dev-feature_registering_mandate
This package is auto-updated.
Last update: 2023-04-19 21:14:36 UTC
README
PHP client for S-Money API.
The following features of the S-Money API are implemented:
- user creation and update
- subaccount creation and update
- bank account creation, update and delete
- bank card registration creation
- KYC request creation
- you can also retrive SEPA payment or transfert payment
Feel free to submit a PR or contact us if you need a missing feature.
The package uses Guzzle as an HTTP client.
Installation
This package can be installed with composer
composer require assoconnect/smoney-client
Usage
This package provides several managers to handle the different S-Money features. They are self documented.
For instance, the following code creates a new User on S-Money:
$guzzle = GuzzleHttp\Client(); $client = new AssoConnect\SMoney\Client('YOUR S-MONEY ENDPOINT', 'YOUR S-MONEY TOKEN', $guzzle); // Create a new User $user = new AssoConnect\SMoney\Object\User([ 'appUserId' => 'appuserid-' . uniqid(), 'type' => AssoConnect\SMoney\Object\User::TYPE_PROFESSIONAL_CLIENT, 'profile' => new AssoConnect\SMoney\Object\UserProfile([ 'civility' => UserProfile::CIVILITY_MR, 'firstname' => 'Test', 'lastname' => 'McTestington', 'birthdate' => new DateTime(), 'address' => new AssoConnect\SMoney\Object\Address([ 'street' => 'rue du Test', 'zipcode' => '75002', 'city' => 'TestVille', 'country' => 'FR', ]), 'email' => 'test-' . uniqid() . '@test.com', ]), 'company' => new AssoConnect\SMoney\Object\Company([ 'name' => 'CompanyName', 'siret' => '123456789', 'nafCode' => '4741Z', ]) ]); $userManager = new AssoConnect\SMoney\Manager\UserManager($client); $userManager->createUser($userPro)->id; // S-Money's id of this newly created user
Main concepts
User and SubAccount
An S-Money User is the holder of an financial account maintained on S-Money servers. It can be a company or a person. Such a User is identified by two ids:
- one generated by S-Money as an auto-incremented integer named "id"
- one generated by the third party as a string named "app user id"
A default sub account is created for each User. It's app user id is the same as the parent User.
More sub accounts can be created by the third party.
When making a payment on S-Money (to/from outside or within S-Money)this default sub account is used for the sender and beneficiary unless stated otherwise.
Payment vs account top-up
For payment coming from outside of S-Money (bank transfer, card payment, ...), if the beneficiary is the same as the card holder (or bank account holder, ...) then this operation is not a payment but an account top-up.
S-Money used a boolean named isMine
to set to true
when the operation is indeed a top-up and to false
when it is a payment.
Redirects and callbacks
When a person submits a form hosted by S-Money (card payment, mandate signature, ...), he is redirected to a confirmation page hosted by the third party. The URL of this page is named the "redirect URL" or "return URL".
As this web request may fail (is the user closes his browser too soon for instance), S-Money also sends another request to the third party server with a payload about the operation. The target URL of this request is named the "callback URL".
Processing of the operation by the third party is expected to be handled by the callback request while the return request is just for display and user information.