PHP code example of consilience / starling-payments-objects
1. Go to this page and download the library: Download consilience/starling-payments-objects 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/ */
consilience / starling-payments-objects example snippets
use Consilience\Starling\Payments\Response\PaymentDetails;
$paymentDetails = PaymentDetails::fromArray($data);
// or
$paymentDetails = new PaymentDetails($data);
// or
$paymentDetails = PaymentDetails::fromResponse($psr7response);
$status = $paymentDetails->status;
// or
$status = $paymentDetails->getProperty('status');
use Consilience\Starling\Payments\Request\Models\Endpoint;
use Consilience\Starling\Payments\Request\GetPaymentServiceBusiness;
use Consilience\Starling\Payments\Response\BusinessInformation;
$endpoint = new Endpoint($myPaymentBusinessUid, Endpoint::INSTANCE_SANDBOX);
$message = new GetPaymentServiceBusiness($endpoint);
// $client is created to accept and send PSR-7 requests.
// Note also the client must use a signing provider suitable for
// the Starling Payments API.
$response = $client->send($message->getRequest());
// Create the response object from the HTTP respinse:
$responseObject = BusinessInformation::fromResponse($response);
var_dump($responseObject);
/*
object(Consilience\Starling\Payments\Response\BusinessInformation)#235 (4) {
["paymentBusinessUid":protected]=>
string(36) "4b5de5aa-7752-21ea-8219-2f948454a2d1"
["name":protected]=>
string(14) "My Business Name"
["netSenderCap":protected]=>
object(Consilience\Starling\Payments\Response\Models\CurrencyAndAmount)#232 (3) {
["currency":protected]=>
string(3) "GBP"
["minorUnits":protected]=>
int(10000)
}
}
*/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.