Download the PHP package currence/emandates without Composer
On this page you can find all versions of the php package currence/emandates. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download currence/emandates
More information about currence/emandates
Files in currence/emandates
Package emandates
Short Description Supporting libraries for eMandates protocol
License MIT
Informations about the package emandates
eMandates PHP Library
PHP library for Dutch electronic SEPA direct debit mandates (eMandates) using the iDx protocol. It provides a complete implementation for issuing, amending, cancelling, and checking the status of eMandates through the Currence eMandates scheme.
Requirements
- PHP >= 8.1 (compatible through 8.4)
- PHP extensions:
ext-domext-simplexmlext-curlext-openssl
Installation
Then include the Composer autoloader in your application:
Configuration
The library needs credentials, certificate paths, and acquirer URLs before it can communicate with the eMandates platform. There are three ways to provide configuration.
Option 1: Global config array with Configuration::getDefault()
Create a file (e.g. eMandatesConfig.php) that populates a global array:
Then obtain a Configuration object:
Option 2: Constructor
Build a Configuration directly:
Option 3: XML config file with Configuration::load()
If you store settings in an XML file:
Load it:
Usage Examples
Creating a Communicator
CoreCommunicator handles SEPA Core mandates. B2BCommunicator extends it for SEPA B2B mandates and adds cancellation support.
1. Directory Request -- Get List of Debtor Banks
2. New Mandate -- Issue a New eMandate
3. Amendment -- Amend an Existing Mandate
4. Cancellation -- Cancel a Mandate (B2B only)
Cancellation is only available through B2BCommunicator.
5. Get Status -- Check Transaction Status
After the debtor returns from the bank, check the transaction outcome.
Custom Logger
Implement LoggerInterface to capture log output (e.g. to a database):
Pass the logger when constructing a communicator:
Error Handling
All communicator methods (Directory, NewMandate, Amend, Cancel, GetStatus) return response objects that include error information rather than throwing exceptions to the caller. This includes acquirer errors, unexpected response formats, missing XML elements, and non-XML error messages.
The ErrorResponse object provides these properties:
| Property | Description |
|---|---|
ErrorCode |
Machine-readable error code from the acquirer |
ErrorMessage |
Human-readable error description |
ErrorDetails |
Additional detail about the error |
SuggestedAction |
Recommended corrective action |
ConsumerMessage |
Message suitable for display to the end user |
Note: Transaction response objects (NewMandateResponse, AmendmentResponse, CancellationResponse) also accept AcquirerStatusRes XML. In this case the response will not have an IssuerAuthenticationUrl, so always use null-safe access:
If a communication-level error occurs (e.g. invalid XML response, schema validation failure), a CommunicatorException may be thrown internally. This exception provides errorCode and errorMessage as readonly properties:
Upgrading from the Legacy Version
If you are upgrading from the older PHP 5.5+ version of this library, see UPGRADE.md for a complete list of breaking changes and migration steps.
License
This library is released under the MIT License.
Copyright (c) 2018 Currence-Online
All versions of emandates with dependencies
ext-dom Version *
ext-simplexml Version *
ext-curl Version *
ext-openssl Version *
robrichards/xmlseclibs Version ^3.1