PHP code example of piyushjaiswal / paysprint

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

    

piyushjaiswal / paysprint example snippets


public function checkIP()


use PiyushJaiswal\Services\IPCheckService;

$ipCheckService = new IPCheckService();
$response = $ipCheckService->checkIP();


public function checkCashBalance()

use PiyushJaiswal\Services\CashBalanceService;

$cashBalanceService = new CashBalanceService();
$response = $cashBalanceService->checkCashBalance();


public function getOperators($serviceType)

use PiyushJaiswal\Services\MobileDTHRechargeService;

$operatorService = new MobileDTHRechargeService();
$response = $operatorService->getOperators('mobile');


public function hlrCheck($mobileNumber, $type)

use PiyushJaiswal\Services\MobileDTHRechargeService;

$hlrCheckService = new MobileDTHRechargeService();
$response = $hlrCheckService->hlrCheck('9876543210', 'mobile');


 
public function dthCheck($caNumber, $operator)


use PiyushJaiswal\Services\MobileDTHRechargeService;

$dthCheckService = new MobileDTHRechargeService();
$response = $dthCheckService->dthCheck('123456789', 'TataSky');


public function browsePlan($circle, $operator)

use PiyushJaiswal\Services\MobileDTHRechargeService;

$browsePlanService = new MobileDTHRechargeService();
$response = $browsePlanService->browsePlan('Delhi', 'Airtel');

public function doRecharge($operatorId, $mobileNumber, $amount,$refrenceId)

use PiyushJaiswal\Services\MobileDTHRechargeService;

$mobileRechargeService = new MobileDTHRechargeService();
$response = $mobileRechargeService->doRecharge('Airtel', '9876543210', 199,'qdd2233wfa');

public function getBillPaymentOperators()

use PiyushJaiswal\Services\BillPaymentService;

$billPaymentService = new BillPaymentService();
$response = $billPaymentService->getBillPaymentOperators();

if ($response['success']) {
    // Operators fetched successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['error'];
}

public function fetchBill($operator, $canumber, $ad1 = null, $ad2 = null, $ad3 = null)

use PiyushJaiswal\Services\BillPaymentService;

$billPaymentService = new BillPaymentService();
$response = $billPaymentService->fetchBill('1', '9876543210');

if ($response['success']) {
    // Bill fetched successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['error'];
}


public function payBill($payload)
Payload Structure:
Field	Type	Description
canumber	string	Consumer account number
amount	float	Amount to pay
operator	integer	Operator ID
latitude	float	Latitude of user
longitude	float	Longitude of user
referenceid	string	Unique transaction reference ID
bill_fetch.billAmount	float	The bill amount fetched earlier
bill_fetch.dueDate	date	Due date of the bill
bill_fetch.acceptPayment	boolean	Whether the bill accepts payment
bill_fetch.cellNumber	string	Cell number associated with the bill
bill_fetch.userName	string	Name of the consumer


use PiyushJaiswal\Services\BillPaymentService;

$billPaymentService = new BillPaymentService();
$payload = [
    'canumber' => '9876543210',
    'amount' => 200,
    'operator' => 1,
    'latitude' => 27.2046,
    'longitude' => 77.4977,
    'referenceid' => 'REF123456',
    'bill_fetch' => [
        'billAmount' => 200,
        'billnetamount' => 200,
        'billdate' => '2024-09-01',
        'dueDate' => '2024-10-10',
        'acceptPayment' => true,
        'cellNumber' => '9876543210',
        'userName' => 'John Doe'
    ]
];
$response = $billPaymentService->payBill($payload);

if ($response['success']) {
    // Bill payment successful
    print_r($response['data']);
} else {
    // Handle error
    echo $response['error'];
}


public function billStatus($referenceId)
Required Parameters:
Parameter	Type	Description
referenceId	string	The unique transaction reference ID


use PiyushJaiswal\Services\BillPaymentService;

$billPaymentService = new BillPaymentService();
$response = $billPaymentService->billStatus('REF123456');

if ($response['success']) {
    // Payment status retrieved
    print_r($response['data']);
} else {
    // Handle error
    echo $response['error'];
}


public function fetchLicBill($canumber, $mode, $ad1 = null, $ad2 = null)
Required Parameters:
Parameter	Type	Description
canumber	string	LIC policy number
mode	string	Mode of the transaction (e.g., online/offline)
ad1	string	(Optional) Additional parameter 1
ad2	string	(Optional) Additional parameter 2

use PiyushJaiswal\Services\LICService;

$licService = new LICService();
$response = $licService->fetchLicBill('1234567890', 'online');

if ($response['status']) {
    // Bill fetched successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['error'];
}

public function payLicBill($payload)
Payload Structure:
Field	Type	Description
canumber	string	LIC policy number
amount	float	Amount to pay
operator	integer	Operator ID
latitude	float	Latitude of the user
longitude	float	Longitude of the user
referenceid	string	Unique transaction reference ID
ad1	string	Email of the user
ad2	string	Date of birth
bill_fetch.billAmount	float	The fetched bill amount
bill_fetch.billnetamount	float	The net amount to pay
bill_fetch.billdate	date	Date the bill was generated
bill_fetch.dueDate	date	Due date for payment
bill_fetch.acceptPayment	boolean	Whether payment is accepted
bill_fetch.acceptPartPay	boolean	Whether part payment is accepted
bill_fetch.cellNumber	string	Cell number of the policyholder
bill_fetch.userName	string	Name of the policyholder

use PiyushJaiswal\Services\LICService;

$licService = new LICService();
$payload = [
    'canumber' => '1234567890',
    'amount' => 500,
    'operator' => 1,
    'latitude' => 27.2046,
    'longitude' => 77.4977,
    'referenceid' => 'REF123456',
    'ad1' => '[email protected]',
    'ad2' => '1990-01-01',
    'bill_fetch' => [
        'billAmount' => 500,
        'billnetamount' => 500,
        'billdate' => '2024-09-01',
        'dueDate' => '2024-10-10',
        'acceptPayment' => true,
        'acceptPartPay' => false,
        'cellNumber' => '1234567890',
        'userName' => 'John Doe'
    ]
];
$response = $licService->payLicBill($payload);

if ($response['status']) {
    // Payment successful
    print_r($response['data']);
} else {
    // Handle error
    echo $response['error'];
}

public function licBillStatus($referenceId)
Required Parameters:
Parameter	Type	Description
referenceId	string	The unique transaction reference ID

use PiyushJaiswal\Services\LICService;

$licService = new LICService();
$response = $licService->licBillStatus('REF123456');

if ($response['status']) {
    // Payment status retrieved
    print_r($response['data']);
} else {
    // Handle error
    echo $response['error'];
}

public function getFastagOperators()

use PiyushJaiswal\Services\FastagService;

$fastagService = new FastagService();
$response = $fastagService->getFastagOperators();

if ($response['status']) {
    // Operators fetched successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}

public function fetchFastagBill($operator, $canumber, $ad1 = null, $ad2 = null, $ad3 = null)
Required Parameters:
Parameter	Type	Description
operator	string	The Fastag operator code
canumber	string	Fastag account number (vehicle number)
ad1	string	(Optional) Additional parameter 1
ad2	string	(Optional) Additional parameter 2
ad3	string	(Optional) Additional parameter 3

use PiyushJaiswal\Services\FastagService;

$fastagService = new FastagService();
$response = $fastagService->fetchFastagBill('1', 'KA01AB1234');

if ($response['status']) {
    // Bill fetched successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}

public function payFastagBill($payload)
Payload Structure:
Field	Type	Description
canumber	string	Fastag account number (vehicle registration number)
amount	float	Amount to recharge
operator	integer	Operator ID
latitude	float	Latitude of the user
longitude	float	Longitude of the user
referenceid	string	Unique transaction reference ID
bill_fetch.billAmount	float	The fetched bill amount
bill_fetch.billnetamount	float	The net amount to pay
bill_fetch.billdate	date	Date the bill was generated
bill_fetch.dueDate	date	Due date for payment
bill_fetch.acceptPayment	boolean	Whether payment is accepted
bill_fetch.acceptPartPay	boolean	Whether part payment is accepted
bill_fetch.cellNumber	string	Vehicle number or mobile number of the customer
bill_fetch.userName	string	Name of the vehicle owner

use PiyushJaiswal\Services\FastagService;

$fastagService = new FastagService();
$payload = [
    'canumber' => 'KA01AB1234',
    'amount' => 1000,
    'operator' => 1,
    'latitude' => 12.9716,
    'longitude' => 77.5946,
    'referenceid' => 'REF123456',
    'bill_fetch' => [
        'billAmount' => 1000,
        'billnetamount' => 1000,
        'billdate' => '2024-11-01',
        'dueDate' => '2024-12-15',
        'acceptPayment' => true,
        'acceptPartPay' => false,
        'cellNumber' => 'KA01AB1234',
        'userName' => 'John Doe'
    ]
];
$response = $fastagService->payFastagBill($payload);

if ($response['status']) {
    // Payment successful
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}

public function checkFastagStatus($referenceId)
Required Parameters:
Parameter	Type	Description
referenceId	string	The unique transaction reference ID

use PiyushJaiswal\Services\FastagService;

$fastagService = new FastagService();
$response = $fastagService->checkFastagStatus('REF123456');

if ($response['status']) {
    // Payment status retrieved
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}


public function getLPGOperators()


use PiyushJaiswal\Services\LPGService;

$lpgService = new LPGService();
$response = $lpgService->getLPGOperators();

if ($response['status']) {
    // Operators fetched successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}


public function fetchLPGBill($operator, $canumber, $ad1 = null, $ad2 = null, $ad3 = null)
Required Parameters:
Parameter	Type	Description
operator	string	The LPG operator code
canumber	string	LPG consumer number
ad1	string	(Optional) Additional parameter 1
ad2	string	(Optional) Additional parameter 2
ad3	string	(Optional) Additional parameter 3


use PiyushJaiswal\Services\LPGService;

$lpgService = new LPGService();
$response = $lpgService->fetchLPGBill('1', '9876543210');

if ($response['status']) {
    // Bill fetched successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}


public function payLPGBill($payload)
Payload Structure:
Field	Type	Description
canumber	string	LPG consumer number
amount	float	Amount to pay
operator	integer	Operator ID
latitude	float	Latitude of the user
longitude	float	Longitude of the user
referenceid	string	Unique transaction reference ID
ad1	numeric	(Optional) State
ad2	numeric	(Optional) District
ad3	numeric	(Optional) Distributor
bill_fetch.billAmount	float	The fetched bill amount
bill_fetch.billnetamount	float	The net amount to pay
bill_fetch.billdate	date	Date the bill was generated
bill_fetch.dueDate	date	Due date for payment
bill_fetch.acceptPayment	boolean	Whether payment is accepted
bill_fetch.acceptPartPay	boolean	Whether part payment is accepted
bill_fetch.cellNumber	string	LPG consumer number
bill_fetch.userName	string	Name of the consumer


use PiyushJaiswal\Services\LPGService;

$lpgService = new LPGService();
$payload = [
    'canumber' => '9876543210',
    'amount' => 750,
    'operator' => 1,
    'latitude' => 28.7041,
    'longitude' => 77.1025,
    'referenceid' => 'REF123456',
    'ad1' => 22,
    'ad2' => 5,
    'ad3' => 123,
    'bill_fetch' => [
        'billAmount' => 750,
        'billnetamount' => 750,
        'billdate' => '2024-11-01',
        'dueDate' => '2024-12-15',
        'acceptPayment' => true,
        'acceptPartPay' => false,
        'cellNumber' => '9876543210',
        'userName' => 'John Doe'
    ]
];
$response = $lpgService->payLPGBill($payload);

if ($response['status']) {
    // Payment successful
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}


public function checkLPGStatus($referenceId)
Required Parameters:
Parameter	Type	Description
referenceId	string	The unique transaction reference ID



use PiyushJaiswal\Services\LPGService;

$lpgService = new LPGService();
$response = $lpgService->checkLPGStatus('REF123456');

if ($response['status']) {
    // Payment status retrieved
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}

public function getOperators()

use PiyushJaiswal\Services\MunicipalityService;

$municipalityService = new MunicipalityService();
$response = $municipalityService->getOperators();

if ($response['status']) {
    // Operators fetched successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}

public function fetchMunicipalityBill($operator, $canumber, $ad1 = null, $ad2 = null, $ad3 = null)
Required Parameters:
Parameter	Type	Description
operator	string	The municipality operator code
canumber	string	Consumer account number
ad1	string	(Optional) Additional parameter 1
ad2	string	(Optional) Additional parameter 2
ad3	string	(Optional) Additional parameter 3

use PiyushJaiswal\Services\MunicipalityService;

$municipalityService = new MunicipalityService();
$response = $municipalityService->fetchMunicipalityBill('1', '1234567890');

if ($response['status']) {
    // Bill fetched successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}

public function payMunicipalityBill($payload)
Payload Structure:
Field	Type	Description
canumber	string	Consumer account number
amount	float	Amount to pay
operator	integer	Operator ID
latitude	float	Latitude of the user
longitude	float	Longitude of the user
referenceid	string	Unique transaction reference ID
bill_fetch.billAmount	float	The fetched bill amount
bill_fetch.billnetamount	float	The net amount to pay
bill_fetch.billdate	date	Date the bill was generated
bill_fetch.dueDate	date	Due date for payment
bill_fetch.acceptPayment	boolean	Whether payment is accepted
bill_fetch.acceptPartPay	boolean	Whether part payment is accepted
bill_fetch.cellNumber	string	Consumer mobile number
bill_fetch.userName	string	Name of the consumer

use PiyushJaiswal\Services\MunicipalityService;

$municipalityService = new MunicipalityService();
$payload = [
    'canumber' => '1234567890',
    'amount' => 2000,
    'operator' => 1,
    'latitude' => 28.7041,
    'longitude' => 77.1025,
    'referenceid' => 'REF123456',
    'bill_fetch' => [
        'billAmount' => 2000,
        'billnetamount' => 2000,
        'billdate' => '2024-11-01',
        'dueDate' => '2024-12-15',
        'acceptPayment' => true,
        'acceptPartPay' => false,
        'cellNumber' => '1234567890',
        'userName' => 'John Doe'
    ]
];
$response = $municipalityService->payMunicipalityBill($payload);

if ($response['status']) {
    // Payment successful
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}

public function checkMunicipalityStatus($referenceId)
Required Parameters:
Parameter	Type	Description
referenceId	string	The unique transaction reference ID


use PiyushJaiswal\Services\MunicipalityService;

$municipalityService = new MunicipalityService();
$response = $municipalityService->checkMunicipalityStatus('REF123456');

if ($response['status']) {
    // Payment status retrieved
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}


public function generateOTP($name, $card_number, $remarks, $network, $mobile, $amount)
Required Parameters:
Parameter	Type	Description
name	string	The name of the credit card holder
card_number	string	The credit card number
remarks	string	Any additional remarks for the transaction
network	string	The card network (e.g., Visa, Mastercard)
mobile	int	The mobile number associated with the credit card
amount	int	The amount to be paid (must be less than or equal to 49,999)


use PiyushJaiswal\Services\CreditCardService;

$creditCardService = new CreditCardService();
$response = $creditCardService->generateOTP('John Doe', '4111111111111111', 'Test Payment', 'Visa', '9876543210', 5000);

if ($response['status']) {
    // OTP generated successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}


public function payBill($refid, $name, $mobile, $card_number, $amount, $remarks, $network, $otp)
Required Parameters:
Parameter	Type	Description
refid	string	The reference ID for the transaction
name	string	The name of the credit card holder
mobile	int	The mobile number associated with the credit card
card_number	string	The credit card number
amount	int	The amount to be paid
remarks	string	Additional remarks for the payment
network	string	The card network (e.g., Visa, Mastercard)
otp	string	The OTP received for the transaction


use PiyushJaiswal\Services\CreditCardService;

$creditCardService = new CreditCardService();
$response = $creditCardService->payBill('REF123456', 'John Doe', '9876543210', '4111111111111111', 5000, 'Test Payment', 'Visa', '123456');

if ($response['status']) {
    // Payment successful
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}


public function checkCreditCardStatus($referenceId)
Required Parameters:
Parameter	Type	Description
referenceId	string	The unique transaction reference ID


use PiyushJaiswal\Services\CreditCardService;

$creditCardService = new CreditCardService();
$response = $creditCardService->checkCreditCardStatus('REF123456');

if ($response['status']) {
    // Payment status retrieved
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}


public function resendOTP($refid, $ackno)
Required Parameters:
Parameter	Type	Description
refid	string	The reference ID of the transaction
ackno	string	The acknowledgment number of the transaction


use PiyushJaiswal\Services\CreditCardService;

$creditCardService = new CreditCardService();
$response = $creditCardService->resendOTP('REF123456', 'ACK123456');

if ($response['status']) {
    // OTP resent successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}


public function claimRefund($refid, $ackno, $otp)
Required Parameters:
Parameter	Type	Description
refid	string	The reference ID of the transaction
ackno	string	The acknowledgment number of the transaction
otp	string	The OTP for claiming the refund


use PiyushJaiswal\Services\CreditCardService;

$creditCardService = new CreditCardService();
$response = $creditCardService->claimRefund('REF123456', 'ACK123456', '123456');

if ($response['status']) {
    // Refund claimed successfully
    print_r($response['data']);
} else {
    // Handle error
    echo $response['message'];
}
bash
php artisan vendor:publish --tag=paysprint-config