PHP code example of tuurbo / spreedly

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

    

tuurbo / spreedly example snippets


'providers' => [
    ...
   'Tuurbo\Spreedly\SpreedlyServiceProvider'
]

'aliases' => [
    ...
    'Spreedly' => 'Tuurbo\Spreedly\SpreedlyFacade'
]

return [

    ...

    'spreedly' => [
        'key' => '', // (ateway' => '', // ()
        'connect_timeout' => '', // (optional) Default 10 seconds
    ]

];

$config = [
    'key' => '', // () Signing Secret
    'gateway' => '', // (edly)
    'connect_timeout' => '', // (optional) Default 10 seconds
];

$spreedly = new Tuurbo\Spreedly\Spreedly($config);

// The amount must be an integer as per 

// If the call to Spreedly is successful
if ($resp->success()) {
    return $resp->response();
    // $resp->transactionToken();
    // $resp->paymentToken();
    // $resp->message();
}

// If the call to Spreedly fails or payment declines
if ($resp->fails()) {

    // returns array
    return $resp->errors();

    // returns list of errors as a string
    return $resp->errors(true);
}

// Gateway calls.
Spreedly::gateway()->setup();
Spreedly::gateway()->all();
Spreedly::gateway()->show();
Spreedly::gateway()->create();
Spreedly::gateway()->disable();
Spreedly::gateway()->update();
Spreedly::gateway()->transactions();

// If using multiple gateways, you can set the gateway token before the payment call.
Spreedly::gateway()->payment()->purchase();
Spreedly::gateway()->payment()->authorize();

// Uses default gateway.
Spreedly::payment()->all();
Spreedly::payment()->create();
Spreedly::payment()->update();
Spreedly::payment()->disable();
Spreedly::payment()->retain();
Spreedly::payment()->recache();
Spreedly::payment()->store();
Spreedly::payment()->get();
Spreedly::payment()->transactions();
Spreedly::payment()->purchase();
Spreedly::payment()->authorize();
Spreedly::payment()->verify();
Spreedly::payment()->generalCredit();

// Transaction calls
Spreedly::transaction()->all();
Spreedly::transaction()->get();
Spreedly::transaction()->referencing();
Spreedly::transaction()->transcript();
Spreedly::transaction()->purchase();
Spreedly::transaction()->void();
Spreedly::transaction()->credit();
Spreedly::transaction()->capture();
Spreedly::transaction()->complete();