PHP code example of markette / gopay-simple

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

    

markette / gopay-simple example snippets


use Markette\GopaySimple\GopaySimple;

$gopay = new GopaySimple($clientId, $clientSecret);

# For testing purpose
$gopay->setMode($gopay::DEV);

$response = $gopay->call('POST', 'payments/payment', [
	'payer' => [
		'default_payment_instrument' => 'BANK_ACCOUNT',
		'allowed_payment_instruments' => ['BANK_ACCOUNT'],
		'default_swift' => 'FIOBCZPP',
		'allowed_swifts' => ['FIOBCZPP', 'BREXCZPP'],
		'contact' => [
			'first_name' => 'Zbynek',
			'last_name' => 'Zak',
			'email' => '[email protected]',
			'phone_number' => '+420777456123',
			'city' => 'C.Budejovice',
			'street' => 'Plana 67',
			'postal_code' => '373 01',
			'country_code' => 'CZE',
		],
	],
	'target': ['type' => 'ACCOUNT', 'goid' => '_YOUR_GO_ID_',
	'amount' => 150,
	'currency' => 'CZK',
	'order_number' => '001',
	'order_description' => 'pojisteni01',
	'items' => [
		['name' => 'item01', 'amount' => 50],
		['name' => 'item02', 'amount' => 100],
	],
	'additional_params' => [
		array('name' => 'invoicenumber', 'value' => '20160001')
	],
	'return_url' => 'http://www.your-url.tld/return',
	'notify_url' => 'http://www.your-url.tld/notify',
	'lang' => 'cs',
]);

$response = $gopay->call('GET', 'payments/payment/{id}');