1. Go to this page and download the library: Download paydemic/paydemic-php-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/ */
paydemic / paydemic-php-sdk example snippets
$paydemic = new PaydemicPhpSdk('<accessKey>', '<secretAccessKey>')
$paydemic->{ RESOURCE_NAME }->{ METHOD_NAME }
// Create a new purchase link:
$finalUrl = "https://paywalledsite.com/paid-access-article";
$title = "My paid access article title";
$currencyCode = "USD";
$price = 4.0;
$description = "Extra information";
$paydemic->PurchaseLinks->create(
$finalUrl,
$title,
$currencyCode,
$price,
$description
)->then(
// on success
function ($purchaseLink) { /* some code */ },
// on exception
function ($exception) { /* some error handling code */ },
)
// Create a new purchase link:
$purchaseLink = $paydemic->PurchaseLinks->create(
$finalUrl,
$title,
$currencyCode,
$price
)->wait();
// Retrieve an existing purchase link:
$retrieved = $paydemc->PurchaseLinks->retrieve($purchaseLink['id'])->wait();
// List all the existing purchase links under this project:
$listed = $paydemic->PurchaseLinks->listAll()->wait();