PHP code example of gianninasd / pplib
1. Go to this page and download the library: Download gianninasd/pplib 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/ */
gianninasd / pplib example snippets
// will be your own class representing the full billing data
$member = new class {
...
public $firstName = "John";
public $lastName = "Doe";
...
};
$parser = new PaysafeParser();
// create the JSON body first
$obj = $parser->parseRequest( $uuid, $token, $member, $amt );
$body = json_encode($obj, JSON_NUMERIC_CHECK);
$req = new PaymentRequest();
$req->id = "[email protected]";
$req->uuid = uniqid("", true);
$req->body = $body;
// Send the request to the remote third party service provider
$ps = new PaysafePaymentService( "https://somedomain.com/somepath", "some authentication token" );
$resp = $ps->process( $req );
// Process the response
$jsonResponse = $parser->parseResponse( $resp );
echo( $jsonResponse );