Create a time-limited URL

Under certain circumstances, it might be useful to limit the time a link can be used after it was signed.

To do this, Vendo provides a parameter called expires which value is a timestamp after which the URL expires. All time limited links are signed using the URL Signature therefore the expires parameter value cannot be tampered with.

The timestamp must be a unix timestamp. To calculate the expiration timestamp, take the current Unix time and add the seconds you want the URL to be usable.


The example below shows you how to create a one-click link that's valid for the next 15 minutes.
This example uses Vendo's SDK for PHP.


$ttl = (60 * 15) + time(); // 15 minutes in seconds

include __DIR__ . '/../vendor/autoload.php';

$sharedSecret = 'Your_Vendo_Shared_Secret__get_it_from_us';
$oneclikLink = new \VendoSdk\Url\Oneclick($sharedSecret);

$url = $oneclikLink->getSignedUrl();

//redirect the user to Vendo's payment page
//header('Location: ' . $url);
echo $url . PHP_EOL;