PHP code example of nowo-tech / openpay-php
1. Go to this page and download the library: Download nowo-tech/openpay-php 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/ */
nowo-tech / openpay-php example snippets
use Nowo\Openpay\Client;
use Nowo\Openpay\Country;
use Nowo\Openpay\Credentials;
use Nowo\Openpay\Session;
$credentials = new Credentials(
merchantId: getenv('OPENPAY_MERCHANT_ID') ?: '',
privateKey: getenv('OPENPAY_PRIVATE_KEY') ?: '',
country: Country::Mx,
sandbox: true,
publicIp: $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1',
);
$session = new Session($credentials);
$customer = $session->run(static fn (Client $client) => $client->customers->create([
'name' => 'Demo',
'email' => '[email protected]',
]));
bash
composer