The LemonWay API (called Directkit) has two implementations: DirectkitJson2 and DirectkitXml.
The best way to integrate our API is to use the curl_init
function to send POST request to the DirectkitJson2 service (See the example here)
It is the simplest and the most network-efficient way. However if you don't like the json format, you can also send SOAP (XML) requests to DirectkitXml.
SoapClient is the casual method in PHP to consume not only the DirectkitXml but any third-party Web Services
These examples demonstrate how to use the SoapClient, it is tested with PHP 5.4.31 and PHP 7.
In order to use SoapClient
, you have to activate the following extensions in php.ini
extension=php_soap.dll
(Windows) orsoap.so
(Linux)extension=php_openssl.dll
(Windows) oropenssl.so
(Linux)
$client = new SoapClient(DIRECTKIT_WS."?wsdl");
$response = $client->GetWalletTransHistory(array(
"wlLogin" => LOGIN,
"wlPass" => PASSWORD,
"language" => "fr",
"version" => VERSION,
"walletIp" => getUserIP(),
"walletUa" => UA,
"wallet" => "8888"
));
//print the response
echo "<pre>".json_encode($response, JSON_PRETTY_PRINT)."</pre>";
See also: LemonWay API documentation / method GetWalletTransHistory
Open the terminal, run:
php GetWalletDetailsExample.php
Tips: the Quickest way to get PHP running on a Windows PC
(Please refer to the SoapClient manual for more information)
The SoapClient relies upon the WebService description (WSDL) to validate every SOAP requests and parse the SOAP responses. Your PHP Server will download and cache the WSDL in the first call.
You must to keep your WSDL cache in sync with the WebService.
If you got
Fatal error: Uncaught SoapFault exception...
In most case, it means that your cached WSDL is outdated, please refresh the cache using one of the following methods.
In php.ini
you can configure the cache folder and the expire time (ttl) of the WSDL cache or disable it completly.
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
You must to restart PHP server (or Apache) each changes in php.ini
.
But You can also force refresh the cache by deleting every wsdl-*
files in the folder wsdl_cache_dir
. No need to restart your PHP Server.
Please refer to the SoapClient configuration for more information
- Disable cache usage:
ini_set("soap.wsdl_cache_enabled", 0);
- Redefine the expire time to 10 seconds so the cache will refreshed sooner / more frequently:
ini_set("soap.wsdl_cache_ttl", 10);
SOAP-ERROR: Parsing WSDL: Couldn't load from : failed to load external entity
If you has this error, probably your server's IP address has not been whitelisted, please contact support@lemonway.com
- Register a Payer Wallet (RegisterWallet)
- Register a Receiver Wallet (RegisterWallet)
- Update email for Receiver Wallet (UpdateWalletDetails)
- Register a credit card for Payer Wallet (RegisterCard)
- Pay 100.00€ to Payer Wallet with the registered card (MoneyInWithCardId)
- Send 10.00€ from Payer Wallet to Receiver Wallet (SendPayment)
- Register an IBAN for Receiver Wallet (RegisterIBAN)
- Take 10.00€ from Receiver Wallet to the registered IBAN (MoneyOut)