goldbach-algorithms/novalnet-ag

Goldbach 的 Novalnet AG

1.0.1 2022-02-25 19:02 UTC

This package is auto-updated.

Last update: 2024-09-24 23:00:52 UTC


README

License: MIT

NovalnetAG by Goldbach 是一个 PHP 库,用于将 Novalnet 支付系统与 Symfony 和 Drupal 集成。

安装

使用 composer 安装

composer require goldbach-algorithms/novalnet-ag

使用方法

交易

要执行交易,需要分配您的 Novalnet 账户的配置键。然后配置客户、账单地址和支付数据。最后,将生成一个链接到支付页面,客户需要重定向到该页面以完成购买。支付链接在 45 分钟后过期。

# 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
            'test@novalnet.de', //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"
)

退款

在退款过程中,可以退还全部或部分金额。当 'amount' 的值未填写时,将应用全部金额。

# 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 required"
)

许可证

MIT

版权所有 © 2023 Goldbach Algorithms