InLine Checkout with signature generation
Overview
Generate a JWT for authenticating
JWT generation example
<?php
namespace App\Helpers;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Hmac\Sha512;
use Lcobucci\JWT\Signer\Key;
class JwtToken
{
static function getToken(){
$time = time();
$token = (new Builder())
->issuedAt($time) // Configures the time that the token was issue (iat claim)
->expiresAt($time + 3600) // Configures the expiration time of the token (exp claim)
->withClaim('sub', config('demo.vendor_code')) // Configures a new claim, called "sub" ( default subject of the JWT )
->getToken(new Sha512(), new Key(config('demo.vendor_secret'))); // Retrieves the generated token
return (string)$token;
}
}Use cases
Last updated
Was this helpful?

