PHP code example of usameavci / papara-sdk

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

    

usameavci / papara-sdk example snippets

 php
    // Require compsoers autoload file
    eAvci\PaPara\{ PaPara, ShoppingVoucher, ShoppingVoucherEntity, PaParaException };


    // Set environments [ default: test ]
    PaPara::setEnvironment([
        "test" => [
            "url" => "https://test.papara.com/posservice/ApiRequest.asmx",
            "username" => "...",
            "key" => "...",
            "walletno" => "...",
            "referansId" => "...",
            "secret_key" => "...",
        ],
        "prod" => [
            "url" => "https://account.papara.com/posservice/ApiRequest.asmx",
            "username" => "...",
            "referansId" => "...",
            "walletno" => "...",
            "key" => "...",
            "secret_key" => "...",
        ],
    ]);
 php
    try {
        $response = $transaction->send();
        var_dump($response);
    } catch (PaParaException $e) {
        echo $e->getMessage();
    }