1. Go to this page and download the library: Download secupay/sdk 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/ */
secupay / sdk example snippets
// Configuration
$spaceId = 405;
$userId = 512;
$secret = 'FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=';
// Setup API client
$client = new \Secupay\Sdk\ApiClient($userId, $secret);
// Get API service instance
$client->getTransactionService();
$client->getTransactionPaymentPageService();
$userId = 512;
$secret = 'FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=';
// Setup API client
$client = new \Secupay\Sdk\ApiClient($userId, $secret);
$httpClientType = \Secupay\Sdk\Http\HttpClientFactory::TYPE_CURL; // or \Secupay\Sdk\Http\HttpClientFactory::TYPE_SOCKET
$client->setHttpClientType($httpClientType);
//Setup a custom connection timeout if needed. (Default value is: 25 seconds)
$client->setConnectionTimeout(20);
putenv('SCP_HTTP_CLIENT=curl');
public function handleWebhook() {
$requestPayload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
if (empty($signature)) {
// Make additional API call to retrieve the entity state
// ...
} else {
if ($client->getWebhookEncryptionService()->isContentValid($signature, $requestPayload)) {
// Parse requestPayload to extract 'state' value
// $state = ...
// Process entity's state change
// $this->processEntityStateChange($state);
// ...
}
}
// Process the received webhook data
// ...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.