PHP Classes

File: docs/CHARGES.md

Recommend this page to a friend!
  Classes of Ujah Chigozie peter   PHP Payment Gateway Library   docs/CHARGES.md   Download  
File: docs/CHARGES.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PHP Payment Gateway Library
Process payments with multiple gateways
Author: By
Last change:
Date: 5 months ago
Size: 985 bytes
 

Contents

Class file image Download

CHARGE

You can use charge class to calculate and build your transaction fee

Register Charges namespace

use Luminova\ExtraUtils\Payment\Charges;

Initialize charge class instance

$charge = new Charge();

Set total transaction amount (Required)

$charge->setAmount($amount);

Set transaction fee or merchant fee (Optional)

$charge->setFee($amount);

Or Set transaction fee by rate 1.7% (Optional)

$charge->setFeeRate($rate);

Set shipping fee (Optional)

$charge->setShipping($amount);

Build your charges

$builder = $charge->build();

Get charges after building

Get total amount

$totalFloat = $builder->getTotal();

Get total as integer

$totalInt = $builder->toInt();

Convert total to cent integer

$centInt = $builder->toCent();

Convert total to cent float

$centFloat = $builder->toCentAsFloat();

Get Fee

$fee = $builder->getFee();