PHP code example of orkhanahmadov / goldenpay

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

    

orkhanahmadov / goldenpay example snippets


use Orkhanahmadov\Goldenpay\Goldenpay;

$goldenpay = new Goldenpay();
$goldenpay->authenticate('auth-key-here', 'merchant-name-here');

$paymentKey = $goldenpay->payment(100, CardType::VISA(), 'item-description', Language::EN());

$paymentKey->getCode(); // endpoint response code
$paymentKey->getMessage(); // endpoint response message
$paymentKey->getPaymentKey(); // unique payment key
$paymentKey->paymentUrl(); // payment url. you should redirect user to this url to start payment

$paymentResult = $goldenpay->result('payment-key-here');

$paymentResult->getCode(); // status code
$paymentResult->getMessage(); // status message
$paymentResult->getPaymentKey(); // instance of Orkhanahmadov\Goldenpay\Response\PaymentKey
$paymentResult->getMerchantName(); // merchant name
$paymentResult->getAmount(); // charged amount in integer format. 100 = 1.00
$paymentResult->getCheckCount(); // shows how many times this payment key result checked
$paymentResult->getPaymentDate(); // \DateTimeImmutable instance of payment date
$paymentResult->getCardNumber(); // charged card number. only first 6 digits and last 4 digits. Example: 422865******8101
$paymentResult->getLanguage(); // 2 letter interface language: 'lv', 'en' or 'ru'
$paymentResult->getDescription(); // description used for payment
$paymentResult->getReferenceNumber(); // payment reference number

$goldenpay = goldenpay('auth-key-here', 'merchant-name-here'); // returns instance of "Orkhanahmadov\Goldenpay\Goldenpay"
$goldenpay->payment(100, CardType::VISA(), 'your-description', Language::EN());