PHP code example of emresari89 / nestpay

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

    

emresari89 / nestpay example snippets


use Emsa\Common\CreditCard;
use Emsa\Nestpay\Token;
use Emsa\Nestpay\Currency;
use Emsa\Nestpay\Model\Purchase;
use Emsa\Akbank;

$token = new Token('CLIENT_ID', 'USERNAME', 'PASS');
$creditCard = new CreditCard('4355084355084358', '26', '12', '000');
$purchase = new Purchase();
$purchase->setAmount(1);
$purchase->setInstallment(1);
$purchase->setCurrency(Currency::TRY);
$purchase->setCreditCard($creditCard);
$purchase->setTestMode(true);
$response = (AkBank($token))->purchase($purchase);
if($response->isSuccessful()){
    // success!
}