'.hash('sha512', $account_no.':'.gmdate('Y-m-d').':'. $api_key.':'.$unique_id).'
'.$account_no.'
';
// Response von der API
$response_xml = '
1
9543.91
EUR
';
/**
* Retrieval of transactions - Displays last 1000 transactions
*
* IN
* - datefrom: starting date (optional)
* - dateto: ending date (optional)
*
* OUT
* - account: Account number of recipient / sender
* - subject1: Payment purpose 1
* - subject2: Payment purpose 2
* - refid: Reference number
* - reference_id: Reference String from SCI Payment
* - amount: Amount
* - type: Art (1 = internal transaction,
* 2 = S-Pay-internal transfer,
* 101 = fees for internal transaction,
* 102 = fees for S-Pay-interal transfer)
* - rate: exchangerate for transaction amount and account currency
* - currency: currency of sender
* - currencyamount: amount which was sent
* - valuta: valuta time
*/
// Request to API
$request_xml = '
'.hash('sha512', $account_no.':'.gmdate('Y-m-d').':'. $api_key.':'.$unique_id).'
'.$account_no.'
2015-06-01
2015-06-13
';
// Response from API
$response_xml = '
2015-06-01
2015-06-13
E9876543210
Payment purpose 1
Payment purpose 2
1234
123.45
2
2015-06-03 10:19:21
E1234567890
Payment purpose 1
1235
1234.56
2
2015-06-09 14:18:58
';
/**
* Internal transactions between accounts of a customer
*
* IN
* - account: recipients account number
* - amount: amount
* - currency: curreny (EUR oder USD)
* - subject1: payment purpose 1
* - subject2: payment purpose 2
*
* OUT
* - transaction: transaction-ID
*/
// Request to API
$request_xml = '
'.hash('sha512', $account_no.':'.gmdate('Y-m-d').':'. $api_key.':'.$unique_id).'
'.$account_no.'
E1234567890
123.45
EUR
payment purpose 1
payment purpose 2
';
// Response from API
$response_xml = '
E1234567890
123.45
EUR
payment purpose 1
payment purpose 2
1
1234
';
/**
* S-PAY internal transaction
*
* IN
* - account: recipients account number
* - amount: amount
* - currency: currency (EUR oder USD)
* - subject1: payment purpose 1
* - subject2: payment purpose 2
*
* OUT
* - transaction: transaction-ID
*/
// Request to API
$request_xml = '
'.hash('sha512', $account_no.':'.gmdate('Y-m-d').':'. $api_key.':'.$unique_id).'
'.$account_no.'
E1234567890
123.45
EUR
payment purpose 1
payment purpose 2
999719-4589
';
// Response from API
$response_xml = '
E1234567890
123.45
EUR
payment purpose 1
payment purpose 2
999719-4589
1
1234
';
/**
* Retrieval of transaction
*
* IN
* - transaction: Transaction ID
*
* OUT
* - account: Account number of recipient / sender
* - subject1: Payment purpose 1
* - subject2: Payment purpose 2
* - refid: Reference number
* - reference_id: Reference String from SCI Payment
* - amount: Amount
* - type: Art (1 = internal transaction,
* 2 = S-Pay-internal transfer,
* 101 = fees for internal transaction,
* 102 = fees for S-Pay-interal transfer)
* - rate: exchangerate for transaction amount and account currency
* - currency: currency of sender
* - currencyamount: amount which was sent
* - valuta: valuta time
*/
// Request to API
$request_xml = '
'.hash('sha512', $account_no.':'.gmdate('Y-m-d').':'. $api_key.':'.$unique_id).'
'.$account_no.'
1478
';
// Response from API
$response_xml = '
1478
XA0004471041
payment purpose 1
payment purpose 2
1478
-123.45
2
2015-06-11 11:43:29
';
/**
* Verify Account
*
* IN
* - account: account number
*
* OUT
* - status: 1 = account ok; 0 = account not ok
*/
// Request to API
$request_xml = '
'.hash('sha512', $account_no.':'.gmdate('Y-m-d').':'. $api_key.':'.$unique_id).'
'.$account_no.'
XA0004471041
';
// Response from API
$response_xml = '
XA0004471041
1
';
/**
* A possible error while a transaction should be done
*
* This error is shown because the date of 31st of February is not valid.
* In case of an error you will always get the error-code and a short description.
*
*/
// Request to API
$request_xml = '
'.hash('sha512', $account_no.':'.gmdate('Y-m-d').':'. $api_key.':'.$unique_id).'
'.$account_no.'
2015-02-31
';
// Response from API
$response_xml = '
2015-02-31
53
Invalid date value in field (datefrom)
';
/*****************************************************************************
*
* Retrieval via GET-function
*
*****************************************************************************/
$response_xml = file_get_contents('https://s-pay.me/pay/api/?data='.urlencode($request_xml));
print $response_xml;
/*****************************************************************************
*
* Retrieval via Post-function (usage of Curl)
*
*****************************************************************************/
$ch = curl_init('https://www.s-pay.me/pay/api/');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'data='.$request_xml);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response_xml = curl_exec($ch);
echo $response_xml;
?>