PHP code example of payconn / nestpay

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

    

payconn / nestpay example snippets


use Payconn\Common\CreditCard;
use Payconn\Nestpay\Token;
use Payconn\Nestpay\Currency;
use Payconn\Nestpay\Model\Purchase;
use Payconn\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!
}