PHP code example of marcguyer / assembly-callback

1. Go to this page and download the library: Download marcguyer/assembly-callback 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/ */

    

marcguyer / assembly-callback example snippets


use Assembly\Callback;

// get the request body in your preferred way
$requestBody = file_get_contents("php://input");

// use the factory to create an object of the proper type
$callback = Callback\CallbackFactory::factory($requestBody);

use Assembly\Callback;
use PromisePay\PromisePay;

// get the request body in your preferred way
$requestBody = file_get_contents("php://input");

// use the factory to create an object of the proper type
$callback = Callback\CallbackFactory::factory($requestBody);

// config the PromisePay client
PromisePay::Configuration()->environment('prelive');
PromisePay::Configuration()->login('<username>');
PromisePay::Configuration()->password('<api key>');

// validate the callback
$callback->validate();

use Assembly\Callback\Transaction;

class MyTransaction extends Transaction
{
    public function someSpecialHandling() {
        // do something extra special
    }
}

use Assembly\Callback;

// get the request body in your preferred way
$requestBody = file_get_contents("php://input");

// when the type is "transactions", use this extention
Callback\CallbackFactory::registerType(
    'transactions',
    'My_Assembly_Callback_Transaction'
);

// use the factory to create an object of the proper type
$callback = Callback\CallbackFactory::factory($requestBody);