1. Go to this page and download the library: Download 9orky/espago-api-php 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/ */
9orky / espago-api-php example snippets
$apiFactory = new \Gorky\Espago\Factory\ApiFactory(
'https://sandbox.espago.com',
new \Gorky\Espago\Model\ApiCredentials('app_id', 'public_key', 'password')
);
$tokensApi = $apiFactory->buildTokensApi();
// first we need Customer card's representation
$unauthorizedCard = $tokensApi->createUnauthorizedCard(
'4111111111111111',
'John',
'Doe',
'04',
'2020',
'111'
);
// so now we can transform it to a Token
$token = $tokensApi->createToken($unauthorizedCard);
$chargesApi = $apiFactory->buildChargesApi();
// carefuly study Gorky\Espago\Model\Response\Charge and corresponding API documents!
$charge = $chargesApi->createChargeByToken($token, 12.66, 'PLN', 'doughnuts');