1. Go to this page and download the library: Download lloricode/paymaya-sdk-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/ */
lloricode / paymaya-sdk-php example snippets
use Lloricode\Paymaya\DataTransferObjects\Checkout\Customization\CustomizationDto;
use Lloricode\Paymaya\Enums\Environment;
use Lloricode\Paymaya\Paymaya;
$api = new Paymaya(
environment: Environment::Sandbox,
secretKey: 'sk-X8qolYjy62kIzEbr0QRK1h4b4KDVHaNcwMYk39jInSl',
publicKey: 'pk-Z0OSzLvIcOI2UIvDhdTGVVfRSSeiGStnceqwUE7n0Ah',
);
// register (readonly DTO via constructor)
$api->createCustomization(
new CustomizationDto(
logoUrl: 'https://image-logo.png',
iconUrl: 'https://image-icon.png',
appleTouchIconUrl: 'https://image-apple.png',
customTitle: 'Test Title Mock',
colorScheme: '#e01c44',
)
);
// retrieve
$customizationDto = $api->customizations();
// delete
$api->deleteCustomization();
use Lloricode\Paymaya\DataTransferObjects\Webhook\WebhookDto;
use Lloricode\Paymaya\Enums\Environment;
use Lloricode\Paymaya\Enums\Webhook;
use Lloricode\Paymaya\Paymaya;
$api = new Paymaya(
environment: Environment::Sandbox,
secretKey: 'sk-X8qolYjy62kIzEbr0QRK1h4b4KDVHaNcwMYk39jInSl',
publicKey: 'pk-Z0OSzLvIcOI2UIvDhdTGVVfRSSeiGStnceqwUE7n0Ah',
);
// retrieve
/** @var array<string, WebhookDto> $webhooks */
$webhooks = $api->webhooks();
// delete all
foreach ($webhooks as $webhook) {
$api->deleteWebhook($webhook->id);
}
// register (readonly DTOs via constructors)
$createdWebhookDto = $api->createWebhook(
new WebhookDto(
name: Webhook::CHECKOUT_SUCCESS,
callbackUrl: 'https://web.test/test/success'
)
);
// update (create a new readonly DTO with the existing id and new callback URL)
$existing = $webhooks[Webhook::CHECKOUT_SUCCESS];
$updatingDto = new WebhookDto(
id: $existing->id,
name: $existing->name,
callbackUrl: 'https://web.test/test/update-success'
);
$webhookDto = $api->updateWebhooks($updatingDto);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.