PHP code example of globee / payment-api

1. Go to this page and download the library: Download globee/payment-api 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/ */

    

globee / payment-api example snippets




ector = new \GloBee\PaymentApi\Connectors\GloBeeCurlConnector('YOUR_UNIQUE_API_KEY');
$paymentApi = new \GloBee\PaymentApi\PaymentApi($connector);

$paymentRequest = new \GloBee\PaymentApi\Models\PaymentRequest(123.45, '[email protected]');

$response = $paymentApi->createPaymentRequest($paymentRequest);

$paymentRequestId = $response->id; // Save this ID to know when payment has been made
$redirectUrl = $response->redirectUrl; // Redirect your client to this URL to make payment



ector = new \GloBee\PaymentApi\Connectors\GloBeeCurlConnector(
    'YOUR_UNIQUE_API_KEY'
);
$paymentApi = new \GloBee\PaymentApi\PaymentApi($connector);

$response = $paymentApi->getPaymentRequest($paymentRequestId);



estBody = file_get_contents('php://input'); // Get post body
$input = json_decode($requestBody, true); // convert JSON text into array
$data = $input['data']; // Get the data

// Create new Payment Request from the request
$paymentRequest = \GloBee\PaymentApi\Models\PaymentRequest::fromResponse($data);