PHP code example of goldbach-algorithms / novalnet-ag

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

    

goldbach-algorithms / novalnet-ag example snippets


# add use Novalnet
use GoldbachAlgorithms\Novalnet\Novalnet;

# create a instance of Novalnet
$novalnet = new Novalnet();

# set account config keys
$novalnet->setPaymentKey('YOUR_PAYMENT_KEY');
$novalnet->setSignature('YOUR_SIGNATURE');
$novalnet->setTariff('YOUR_TARIFF_CODE');

# set transaction data
$novalnet->setTransaction(
            'CREDITCARD', // payment type
            '7', // amount
            'EUR', // currency
            1, // test mode (true or false)
            '', // return url to redirect (success)
            '' // return url to redirect (error)
        );

# set customer data
$novalnet->setCustomer(
            'Max', // first name
            'Mustermann', // last name
            '[email protected]', //e-mail
            '+49 174 7781423' // mobile number
            '1911-11-11', // birth date
            'm', // gender (m or f)
            '+49 (0)89 123456', // telephone number (optional)
            '' // fax (optional)
        );

# set billing data
$novalnet->setBilling(
            '2', // house number
            'Musterstr', // street
            'Musterhausen', // city
            '12345', // zipcode
            'DE', // country code
            'ABC GmbH', // company name (optional)
        );

# set hide blocks (will change the payment screen)
$novalnet->setHideBlocks(
            [
                'ADDRESS_FORM',
                'SHOP_INFO', 
                'LANGUAGE_MENU', 
                'TARIFF'
            ]
        );

# set skip pages (will change the payment screen)
$novalnet->setSkipPages(
            [
                'CONFIRMATION_PAGE',
                'SUCCESS_PAGE',
                'PAYMENT_PAGE'
            ]
        );

# generating payment link
$payment_link = $novalnet->getLink();

# success returns
stdClass Object (
     [status] => "success"
     [link] => "https://paygate.novalnet.de/nn/d8884c8c299cfdd7232964e5fe788849"
     [secret] => "d8884c8c299cfdd7232964e5fe788849"
)

# error return
stdClass Object (
     [status] => "error"
     [link] => "Invalid payment type or payment type inactive"
)

# add use Novalnet
use GoldbachAlgorithms\Novalnet\Novalnet;

# create a instance of Novalnet
$novalnet = new Novalnet();

# set account payment key
$novalnet->setPaymentKey('YOUR_PAYMENT_KEY');

# config refund data
$refund = $novalnet->refund(
            '14533600047325226', // tid
            'fail', // reason
            'EN', // language
            '200' // amount to refund (optional)
        );

# success returns
stdClass Object (
     [status] => "success"
     [tid] => "14533600047325226"
     [refunded_amount] => "200"
)

# error return
stdClass Object (
     [status] => "error"
     [message] => "Amount larger than zero