PHP code example of payconn / ipara

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


use Payconn\Ipara;
use Payconn\Ipara\Token;
use Payconn\Ipara\Product;
use Payconn\Ipara\Model\Purchase;
use Payconn\Common\CreditCard;

$token = new Token('YOUR_PUBLIC_KEY', 'YOUR_PRIVATE_KEY');
$purchase = new Purchase();
$purchase->setTestMode(true);
$purchase->setAmount(100);
$purchase->setInstallment(1);
$purchase->setFirstName('Murat');
$purchase->setLastName('Sac');
$purchase->setEmail('[email protected]');
$purchase->addProduct((new Product('001', 'Test', 100)));
$purchase->setCreditCard((new CreditCard('4282209027132016', '2024', '12', '358'))
    ->setHolderName('MuratSac'));
$purchase->generateOrderId();
$response = (new Ipara($token))->purchase($purchase);
if($response->isSuccessful()){
    // success!
}