Properties

$version

$version : string

Type

string — API VERSION

$urls

$urls : array

Type

array — The API urls (with fallback)

$directLinkPath

$directLinkPath : string

Type

string — The directlink part

$exportPath

$exportPath : string

Type

string — The export part

$reconciliationPath

$reconciliationPath : string

Type

string — The reconciliation part

$identifier

$identifier : string

Type

string — The Dalenys identifier

$password

$password : string

Type

string — The Dalenys password

Methods

__construct()

__construct(string  $identifier, string  $password, array  $urls, \Dalenys_Api_Sender_Sendable  $sender, \Dalenys_Api_Hash_Hashable  $hash) 

Instanciate

Parameters

string $identifier

Dalenys identifier

string $password

Dalenys password

array $urls

Dalenys URLS

\Dalenys_Api_Sender_Sendable $sender

The sender object to use

\Dalenys_Api_Hash_Hashable $hash

The hashing object to use

setCredentials()

setCredentials(string  $identifier, string  $password) 

Configurate API credentials

Parameters

string $identifier

The Dalenys identifier

string $password

The Dalenys password

setVersion()

setVersion(string  $version) 

Set default Dalenys VERSION parameter

Parameters

string $version

The VERSION number (ex: 3.0)

payment()

payment(string  $cardPan, string  $cardDate, string  $cardCryptogram, string  $cardFullName, integer  $amount, string  $orderId, string  $clientIdentifier, string  $clientEmail, string  $clientIP, string  $description, string  $clientUserAgent, array  $options = array()) : array

Directlink payment

You have to specify SENSIBLE payment data (card, cryptogramm...)

Usage example:

$api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

// 10 EUR payment
$result = $api->payment(
 '1111222233334444',
 '04-15',
 132,
 'john doe',
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
);

print_r($result);

Parameters

string $cardPan

The card number (sensible)

string $cardDate

The card validity date (sensible) Format mm-yy

string $cardCryptogram

The card cryptogram (sensible)

string $cardFullName

The card full name

integer $amount

The amount (in the currency smallest subdivision Ex: $amount = 100 > 1€)

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $clientIdentifier

The client identifier (ex: login)

string $clientEmail

The client email

string $clientIP

The client public IP

string $description

The transaction descrtiption

string $clientUserAgent

The client user agent

array $options

Some other payment options (@see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array —

The result array. Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Transaction succeded',
 'OPERATIONTYPE' => 'payment',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
]

authorization()

authorization(string  $cardPan, string  $cardDate, string  $cardCryptogram, string  $cardFullName, integer  $amount, string  $orderId, string  $clientIdentifier, string  $clientEmail, string  $clientIP, string  $description, string  $clientUserAgent, array  $options = array()) : array

Directlink authorization

You have to specify SENSIBLE payment data (card, cryptogramm...)

Usage example:

$api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

// 10 EUR payment
$result = $api->authorization(
 '1111222233334444',
 '04-15',
 132,
 'john doe',
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
);

print_r($result);

Parameters

string $cardPan

The card number (sensible)

string $cardDate

The card validity date (sensible) Format mm-yy

string $cardCryptogram

The card cryptogram (sensible)

string $cardFullName

The card full name

integer $amount

The amount (in the currency smallest subdivision Ex: $amount = 100 > 1€)

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $clientIdentifier

The client identifier (ex: login)

string $clientEmail

The client email

string $clientIP

The client public IP

string $description

The transaction descrtiption

string $clientUserAgent

The client user agent

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array —

The result array. Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Transaction succeded',
 'OPERATIONTYPE' => 'authorization',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
]

credit()

credit(string  $cardPan, string  $cardDate, string  $cardCryptogram, string  $cardFullName, integer  $amount, string  $orderId, string  $clientIdentifier, string  $clientEmail, string  $clientIP, string  $description, string  $clientUserAgent, array  $options = array()) : array

Directlink credit

You have to specify SENSIBLE card data (card, cryptogramm...)

Usage example:

$api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

// 10 EUR credit
$result = $api->credit(
 '1111222233334444',
 '04-15',
 132,
 'john doe',
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
);

print_r($result);

Parameters

string $cardPan

The card number (sensible)

string $cardDate

The card validity date (sensible) Format mm-yy

string $cardCryptogram

The card cryptogram (sensible)

string $cardFullName

The card full name

integer $amount

The amount (in the currency smallest subdivision Ex: $amount = 100 > 1€)

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $clientIdentifier

The client identifier (ex: login)

string $clientEmail

The client email

string $clientIP

The client public IP

string $description

The transaction descrtiption

string $clientUserAgent

The client user agent

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array —

The result array. Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Transaction succeded',
 'OPERATIONTYPE' => 'credit',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
]

oneClickPayment()

oneClickPayment(string  $alias, integer  $amount, string  $orderId, string  $clientIdentifier, string  $clientEmail, string  $clientIP, string  $description, string  $clientUserAgent, array  $options = array()) : array

This method is used to initiate a oneClick transaction using an ALIAS

You have to process an authorization or a payment with the option CREATEALIAS = yes to get an ALIAS

Usage example:

$api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

// 10 EUR standard payment (with alias creation)
$result = $api->payment(
 '1111222233334444',
 '04-15',
 132,
 'john doe',
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
 ['CREATEALIAS' => 'yes']
);

$result2 = $api->oneClickPayment(
 $result['ALIAS'],
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
);

Parameters

string $alias

The card ALIAS

integer $amount

The amount (in the currency smallest subdivision Ex: $amount = 100 > 1€)

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $clientIdentifier

The client identifier

string $clientEmail

The client EMAIL

string $clientIP

The client public IP

string $description

The transaction description

string $clientUserAgent

The client user agent

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array —

The result array. Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Transaction succeded',
 'OPERATIONTYPE' => 'payment',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
]

oneClickAuthorization()

oneClickAuthorization(string  $alias, integer  $amount, string  $orderId, string  $clientIdentifier, string  $clientEmail, string  $clientIP, string  $description, string  $clientUserAgent, array  $options = array()) : array

This method is used to initiate a oneClick transaction using an ALIAS

You have to process an authorization or a payment with the option CREATEALIAS = yes to get an ALIAS

Usage example:

$api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

// 10 EUR standard payment (with alias creation)
$result = $api->payment(
 '1111222233334444',
 '04-15',
 132,
 'john doe',
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
 ['CREATEALIAS' => 'yes']
);

$result2 = $api->oneClickAuthorization(
 $result['ALIAS'],
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
);

Parameters

string $alias

The card ALIAS

integer $amount

The amount (in the currency smallest subdivision Ex: $amount = 100 > 1€)

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $clientIdentifier

The client identifier

string $clientEmail

The client EMAIL

string $clientIP

The client public IP

string $description

The transaction description

string $clientUserAgent

The client user agent

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array —

The result array. Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Transaction succeded',
 'OPERATIONTYPE' => 'authorization',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
]

refund()

refund(string  $transactionId, string  $orderId, string  $description, array  $options = array()) : array

This method is used to refund a transaction

Usage example:

  • 
    $api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

$result = $api->refund( 'A123', 'order_123', 'sample refund' );

Parameters

string $transactionId

The transaction id to refund

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $description

The transaction description

array $options

Returns

array —

The result array. Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Transaction succeded',
 'OPERATIONTYPE' => 'refund',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
]

capture()

capture(string  $transactionId, string  $orderId, string  $description, array  $options = array()) : array

This method is used to capture an authorization

Usage example:

  • 
    $api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

$result = $api->capture( 'A123', 'order_123', 'sample refund' );

Parameters

string $transactionId

The authorization id to capture

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $description

The transaction description

array $options

Returns

array —

The result array. Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Transaction succeded',
 'OPERATIONTYPE' => 'capture',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
]

subscriptionAuthorization()

subscriptionAuthorization(string  $alias, integer  $amount, string  $orderId, string  $clientIdentifier, string  $clientEmail, string  $clientIP, string  $description, string  $clientUserAgent, array  $options = array()) : array

This method is used to initiate a subscription transaction using an ALIAS

You have to process an authorization or a payment with the option CREATEALIAS = yes to get an ALIAS

Usage example:

$api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

// 10 EUR standard payment (with alias creation)
$result = $api->payment(
 '1111222233334444',
 '04-15',
 132,
 'john doe',
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
 ['CREATEALIAS' => 'yes']
);

$result2 = $api->subscriptionAuthorization(
 $result['ALIAS'],
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
);

Parameters

string $alias

The card ALIAS

integer $amount

The amount (in the currency smallest subdivision Ex: $amount = 100 > 1€)

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $clientIdentifier

The client identifier

string $clientEmail

The client EMAIL

string $clientIP

The client public IP

string $description

The transaction description

string $clientUserAgent

The client user agent

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array —

The result array. Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Transaction succeded',
 'OPERATIONTYPE' => 'payment',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
]

subscriptionPayment()

subscriptionPayment(string  $alias, integer  $amount, string  $orderId, string  $clientIdentifier, string  $clientEmail, string  $clientIP, string  $description, string  $clientUserAgent, array  $options = array()) : array

This method is used to initiate a oneClick transaction using an ALIAS

You have to process an authorization or a payment with the option CREATEALIAS = yes to get an ALIAS

Usage example:

$api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

// 10 EUR standard payment (with alias creation)
$result = $api->payment(
 '1111222233334444',
 '04-15',
 132,
 'john doe',
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
 ['CREATEALIAS' => 'yes']
);

$result2 = $api->subscriptionPayment(
 $result['ALIAS'],
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
);

Parameters

string $alias

The card ALIAS

integer $amount

The amount (in the currency smallest subdivision Ex: $amount = 100 > 1€)

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $clientIdentifier

The client identifier

string $clientEmail

The client EMAIL

string $clientIP

The client public IP

string $description

The transaction description

string $clientUserAgent

The client user agent

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array —

The result array. Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Transaction succeded',
 'OPERATIONTYPE' => 'payment',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
]

stopNTimes()

stopNTimes(string  $scheduleId, array  $options = array()) : array

This method is used to stop a N times scheduling

Usage example:

$api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

// 10 EUR standard payment (with alias creation)
$result = $api->stopNTimes('A123');

Parameters

string $scheduleId

The schedule id

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array

redirectForPayment()

redirectForPayment(integer  $amount, string  $orderId, string  $clientIdentifier, string  $clientEmail, string  $clientIP, string  $description, string  $clientUserAgent, array  $options = array()) : array

Redirect a cardholder to a hosted payment page (wallet or direct debit payment methods)

In case of success, you will have to display the REDIRECTHTML code with a base64_decode to redirect the user to the payment page.

Usage example:

$api = Dalenys_Api_ClientBuilder::buildSandboxDirectLinkClient('IDENTIFIER', 'PASSWORD');

// 10 EUR standard payment
$result = $api->redirectForPayment(
 1000,
 'order_123',
 'john_doe42',
 'john.doe@mail.com',
 '178.152.42.44',
 'sample transaction',
 'firefox'
 ['CREATEALIAS' => 'yes']
);

echo base64_decode($result['REDIRECTHTML']);

Parameters

integer $amount

The amount (in the currency smallest subdivision Ex: $amount = 100 > 1€)

string $orderId

The orderid (should be unique by transaction, but no unicity check are performed)

string $clientIdentifier

The client identifier

string $clientEmail

The client EMAIL

string $clientIP

The client public IP

string $description

The transaction description

string $clientUserAgent

The client user agent

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array —

The result array. It will contains a REDIRECTHTML wich contains a base64 redirection code for the payment supplier page. Will look like:

[
 'CODE' => '0002',
 'MESSAGE' => 'Waiting for redirection',
 'OPERATIONTYPE' => 'payment',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
 'REDIRECTHTML' => 'ksdjfkldsjfkldjsklfjdsfklds'
]

getTransactionsByTransactionId()

getTransactionsByTransactionId(string  $transactionId, string  $destination = null, string  $compression = 'GZIP') : array

Get a transaction by this ID

Parameters

string $transactionId

The transaction ID

string $destination

This parameter accept 3 possibilities:

  • url > will throw the report to the specified URL (csv)
  • email > will throw the report to the specified email (csv)
  • null > will return the transaction data directly
string $compression

ZIP / GZIP or BZIP

Returns

array —

The result array. It will contains a DATA parameters wich contains the transaction Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Operation succeeded',
 'OPERATIONTYPE' => 'payment',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
 'DATA' => [
     0 => [
         'IDENTIFIER' => 'IDENTIFIER',
         // ...
     ]
]

getTransactionsByOrderId()

getTransactionsByOrderId(string  $orderId, string  $destination = null, string  $compression = 'GZIP') : array

Get a transaction by order ID

Parameters

string $orderId

The transaction orderid ID

string $destination

This parameter accept 3 possibilities:

  • url > will throw the report to the specified URL (csv)
  • email > will throw the report to the specified email (csv)
  • null > will return the transaction data directly
string $compression

ZIP / GZIP or BZIP

Returns

array —

The result array. It will contains a DATA parameters wich contains the transaction Will look like:

[
 'CODE' => '0000',
 'MESSAGE' => 'Operation succeeded',
 'OPERATIONTYPE' => 'payment',
 'ORDERID' => 'order_13213',
 'TRANSACTIONID' => 'A123',
 'DESCRIPTOR' => 'shop'
 'DATA' => [
     0 => [
         'IDENTIFIER' => 'IDENTIFIER',
         // ...
     ]
]

exportTransactions()

exportTransactions(\date  $date, string  $destination, string  $compression = 'GZIP', array  $options = array()) : array

This method is used to recover the list of transactions for a given day or month.

This method only ask for sending a report. The report will be sent by email or http request. This will return the result of the report creation request

Parameters

\date $date

YYYY-MM or YYYY-MM-DD or array(startDate, endDate)

string $destination

This parameter accept 2 possibilities:

  • url > will throw the report to the specified URL (csv)
  • email > will throw the report to the specified email (csv)
string $compression

ZIP / GZIP or BZIP

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array

exportChargebacks()

exportChargebacks(\date  $date, string  $destination, string  $compression = 'GZIP', array  $options = array()) : array

Export the list of chargebacked transactions for a given day or month.

This method only ask for sending a report. The report will be sent by email or http request. This will return the result of the report creation request

Parameters

\date $date

YYYY-MM or YYYY-MM-DD or array(startDate, endDate)

string $destination

This parameter accept 2 possibilities:

  • url > will throw the report to the specified URL (csv)
  • email > will throw the report to the specified email (csv)
string $compression

ZIP / GZIP or BZIP

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array

exportReconciliation()

exportReconciliation(\date  $date, string  $destination, string  $compression = 'GZIP', array  $options = array()) : array

Export the reconciliation

This method only ask for sending a report. The report will be sent by email or http request. This will return the result of the report creation request

Parameters

\date $date

YYYY-MM or YYYY-MM-DD or array(startDate, endDate)

string $destination

This parameter accept 2 possibilities:

  • url > will throw the report to the specified URL (csv)
  • email > will throw the report to the specified email (csv)
string $compression

ZIP / GZIP or BZIP

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array

exportReconciledTransactions()

exportReconciledTransactions(\date  $date, string  $destination, string  $compression = 'GZIP', array  $options = array()) : array

Export the list of reconciled transactions for a given day or month.

This method only ask for sending a report. The report will be sent by email or http request. This will return the result of the report creation request

Parameters

\date $date

YYYY-MM or YYYY-MM-DD or array(startDate, endDate)

string $destination

This parameter accept 2 possibilities:

  • url > will throw the report to the specified URL (csv)
  • email > will throw the report to the specified email (csv)
string $compression

ZIP / GZIP or BZIP

array $options

Some other payment options (see http://developer.dalenys.com the dalenys api reference for the full list)

Returns

array

hash()

hash(array  $params = array()) : string

Hash parameters

Parameters

array $params

Returns

string

checkHash()

checkHash(array  $params) : boolean

Check a hash received in a notification/redirection URL

Parameters

array $params

The POST or GET variable to verify

Returns

boolean

setUrls()

setUrls(string|array  $urls) 

Set dalenys base urls

Parameters

string|array $urls

requests()

requests(array  $urls, array  $params = array()) : boolean|string

Send requests with a fallback system

Parameters

array $urls

The url list to request

array $params

Returns

boolean|string

getDirectLinkUrls()

getDirectLinkUrls() : array

Return directlink url with concatened path

Returns

array

getIdentifier()

getIdentifier() : string

Return identifier

Returns

string —

$identifier

getPassword()

getPassword() : string

Return password

Returns

string —

$password

requestOne()

requestOne(  $url, array  $params = array()) : mixed

Send one request

Parameters

$url
array $params

Returns

mixed

getURLs()

getURLs(  $path) : array

Add $path to each url in productionUrls

Parameters

$path

Returns

array

transaction()

transaction(  $orderId,   $clientIdentifier,   $clientEmail,   $clientIP,   $description,   $clientUserAgent, array  $options = array()) : boolean|string

Trigger a transaction

Parameters

$orderId
$clientIdentifier
$clientEmail
$clientIP
$description
$clientUserAgent
array $options

Returns

boolean|string

getTransactions()

getTransactions(  $searchBy,   $id,   $destination,   $compression) : boolean|mixed

Export a transaction

Parameters

$searchBy
$id
$destination
$compression

Returns

boolean|mixed

isHttpUrl()

isHttpUrl(  $url) : boolean

Return true if $url is a http/https url

Parameters

$url

Returns

boolean

isMail()

isMail(  $mail) : boolean

Return true if $mail is a valid email

Parameters

$mail

Returns

boolean

getURL()

getURL(  $path) : string

Return the first url with path

Parameters

$path

Returns

string

getDateOrDateRangeParameter()

getDateOrDateRangeParameter(string|array  $date) : mixed

Handle DATE or STARTDATE/ENDDATE parameters for export methods

Parameters

string|array $date

Returns

mixed

getVersion()

getVersion(array  $options = array()) : string

Get Dalenys API VERSION

Parameters

array $options

Returns

string —

The version number

amountOrAmounts()

amountOrAmounts(integer  $amount, array  $params) : array

Handle amount or ntimes amounts parameter

Parameters

integer $amount
array $params

Returns

array —

Edited $params