PHP code example of crowdproperty / modulr-hmac-php-client
1. Go to this page and download the library: Download crowdproperty/modulr-hmac-php-client library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
crowdproperty / modulr-hmac-php-client example snippets
'providers' => [
...
CrowdProperty\ModulrHmacPhpClient\ModulrServiceProvider::class,
...
];
$api = new CrowdProperty\ModulrHmacPhpClient\ModulrApi();
$api->setApiPath('https://api-sandbox.modulrfinance.com/api-sandbox')
->setApiKey('API_KEY')
->setHmacSecret('HMAC_SECRET')
->setDebugMode(true);
...
$api->customers()->createCustomer((string) $customer);
namespace App\Http\Controllers;
use CrowdProperty\ModulrHmacPhpClient\Facades\ModulrApi;
use CrowdProperty\ModulrHmacPhpClient\Model\Address;
use CrowdProperty\ModulrHmacPhpClient\Model\Associate;
use CrowdProperty\ModulrHmacPhpClient\Model\Customer;
class DemoController extends BaseController
{
public function __construct()
{
$customer = new Customer();
$customer->setTcsVersion(1);
$customer->setExpectedMonthlySpend(0);
$customer->setType('INDIVIDUAL');
$associate = new Associate();
$associate->setVerificationStatus('EXVERIFIED');
$associate->setEmail('[email protected] ');
$associate->setPhone('07777777777');
$associate->setFirstName('First');
$associate->setLastName('Last');
$associate->setDateOfBirth('1970-01-18');
$associate->setType('INDIVIDUAL');
$associate->setApplicant(true);
$address = new Address();
$address->setAddressLine1('Address1');
$address->setAddressLine2('Address2');
$address->setPostCode('Postcode');
$address->setPostTown('town');
$address->setCountry('GB');
$associate->setHomeAddress($address);
$customer->setAssociates([$associate]);
$response = ModulrApi::customers()->createCustomer((string) $customer);
var_dump($response);
}
}
sh
php artisan vendor:publish --provider="CrowdProperty\ModulrHmacPhpClient\ModulrServiceProvider"