The helper you can use for payment transactions. And get, delete, update payment details.
function add_payment($payment) {.....}
Supported hooks
Filter name: before_add_paymentDescription: This filter would be executed before add payment into the database in add_payment helper.
Usage:
// The filter callback function is based on the filter.add_filter(‘before_add_payment’,‘before_add_payment_callback_fun’,10,1);functionbefore_add_payment_callback_fun($payment){ // code}
Filter name: should_add_paymentDescription: This filter would be executed before add payment into database in add_payment helper.
Usage:
// The filter callback function is based on the filter.add_filter(‘should_add_payment’,‘should_add_payment_callback_fun’,10,1);functionshould_add_payment_callback_fun($payment){ // code}
hook name: pre.add.payment
Description: This hook would be executed before add payment into the database in add_payment helper.
Usage:
hook name: post.add.payment
Description: This hook would be executed after add payment into the database in add_payment helper.
Usage:
Usage
Request Parameters
Parameters in array format includes following attributes:
Param
Type
Required
Default
Description
description
Character
Null
The description of a specific payment.
booking_id
Integer
Yes
0
The booking_id for a specific payment.
amount
Decimal Integer
Yes
0
The amount for a specific payment.
is_captured
Integer
0
The is_captured for a specific charge.
selling_date
Date
Yes
Date
The selling_date for specific payment ( must provide date in gmdate() format).
user_id
Integer
Yes
Null
The user_id for a specific payment.
customer_id
Integer
0
The customer_id for a specific payment.
parent_charge_id
Integer
Null
The parent_charge_id for specific payment.
company_id
Integer
Yes
0
The company_id for specific payment.
payment_type_id
Integer
0
The payment_type_id for a specific payment.
gateway_charge_id
Character
Yes
Null
The gateway charge_id for a specific payment.
payment_gateway_used
Character
Yes
Null
The payment gateway is used for a specific payment.
selected_gateway
Character
Yes
Null
The selected_gateway for a specific payment.
cvc
Integer
Yes
Null
The CVC of the user for a specific payment.
folio_id
Integer
0
The folio_id for a specific payment.
Response
function get_payment($payment_id) {....}
Supported hooks
Filter name: before_get_payment Description: This filter would be executed before retrieving payment details from database in get_payment helper.
Usage:
Filter name: should_get_paymentDescription: This filter would be executed before retrieving payment details from database in get_payment helper.
Usage:
hook name: pre.get.payment
Description: This hook would be executed before retrieving payment details from database in get_payment helper.
Usage:
hook name: post.get.payment
Description: This hook would be executed after retrieving payment details from database in get_payment helper.
Usage:
Usage
Request Parameters
Param
Type
Required
Default
Description
$payment_id
Integer
Yes
Null
The primary id of the payment corresponds to the payment table
Response
function update_payment($payment, $payment_id) {....}
Usage
Supported hooks
Filter name: before_update_paymentDescription: This filter would be executed before updatepayment into the database in update_payment helper.
Usage:
Filter name: should_update_paymentDescription: This filter would be executed before update payment into database in update_payment helper.
Usage:
hook name: pre.update.payment
Description: This hook would be executed before update payment into the database in update_payment helper.
Usage:
hook name: post.update.payment
Description: This hook would be executed after update payment into the database in update_payment helper.
Usage:
Request Parameters
Request required payment_id and array format data includes following attributes:
Param
Type
Required
Default
Description
payment_id
Integer
Yes
Null
The primary key of the payment table for a specific payment.
description
Character
Null
The description of a specific payment.
is_captured
Integer
0
The is_captured for a specific charge.
payment_type_id
Integer
Yes
0
The payment_type_id for a specific payment.
selected_gateway
Character
Yes
Null
The selected_gateway for a specific payment.
payment_status
Character
Yes
Null
The payment_status for a specific payment.
folio_id
Integer
0
The folio_id for a specific payment.
Response
function get_payments($filter) {.....}
Supported hooks
Filter name: before_get_paymentsDescription: This filter would be executed before retrieving payment details from database in get_payments helper.
Usage:
Filter name: should_get_paymentsDescription: This filter would be executed before retrieving payment details from database in get_payments helper.
Usage:
hook name: pre.get.payments
Description: This hook would be executed before retrieving payment details from database in get_payments helper.
Usage:
hook name: post.get.payments
Description: This hook would be executed after retrieving payment details from database in get_payments helper.
Usage:
Usage
Request Parameters
parameter array filter required for payment details.
Param
Type
Required
Default
Description
payment_id
Integer
Yes
Null
The primary key id of the payment table for a specific payment.
booking_id
Integer
Yes
Null
The booking_id for specific payment.
customer_id
Integer
Yes
Null
The customer_id for a specific payment.
folio_id
Integer
Yes
Null
The folio_id for a specific payment.
Response
function delete_payment($payment_id) {.....}
Usage
Request Parameters
Param
Type
Required
Default
Description
$payment_id
Integer
Yes
Null
The id of the payment corresponds to the payment table
// The filter callback function is based on the filter.
add_action('pre.add.payment', 'pre_add_payment_callback_fun', 10, 1);
function pre_add_payment_callback_fun($payment) {
// code
}
// The filter callback function is based on the filter.
add_action('post.add.payment', 'post_add_payment_callback_fun', 10, 1);
function post_add_payment_callback_fun($payment) {
// code
}
// for use payment helper you need to add this helper on controller or
// you can autoload this helper.
$this->load->helper('includes/payment');
// add a new payment in payment table.
$payment_id = add_payment($payment);
Response includes the following attributes:
if data have been added successfully it would return the key of specific payment id.
return $payment_id;
if data does not add it will return null.
// The filter callback function is based on the filter.
add_filter( ‘before_get_payment’, ‘before_get_payment_callback_fun’, 10, 1 );
function before_get_payment_callback_fun($payment_id) {
// code
}
// The filter callback function is based on the filter.
add_filter( ‘should_get_payment’, ‘should_get_payment_callback_fun’, 10, 1 );
function should_get_payment_callback_fun($payment_id) {
// code
}
// The filter callback function is based on the filter.
add_action('pre.get.payment', 'pre_get_payment_callback_fun', 10, 1);
function pre_get_payment_callback_fun($payment_id) {
// code
}
// The filter callback function is based on the filter.
add_action('post.get.payment', 'post_get_payment_callback_fun', 10, 1);
function post_get_payment_callback_fun($payment_id) {
// code
}
// Retrieves payment data based on a payment_id.
$payment_data = get_payment($payment_id);
// $response array includes following attributes:
// $response['user_id'] : the user_id of specific payment.
// $response['booking_id'] : the booking_id for specific payment .
// $response['selling_date'] : the selling_date for specific payment.
// $response['company_id'] : the company_id for specific payment.
// $response['amount'] : the amount for specific payment.
// $response['customer_id'] : the customer_id for specific payment.
// $response['payment_type_id'] : the payment_type_id for specific payment.
// $response['description'] : the description for specific payment.
// $response['selected_gateway'] : the selected_gateway for specific payment.
// $response['capture_payment_type'] : the capture_payment_type for specific payment.
// and many more attributes for table payment.
// Successfully response giving you array of payment data.
Array
(
[payment_id] => 1
[description] => payment
[date_time] => 2022-01-26 17:19:53
[booking_id] => 1
[amount] => 100.00
[payment_type_id] => 1
[credit_card_id] => 1
[selling_date] =>
[is_deleted] => 0
[user_id] => 1
[customer_id] => 1
[payment_gateway_used] =>
[gateway_charge_id] =>
[read_only] =>
[payment_status] => charge
[parent_charge_id] =>
[is_captured] => 0
[logs] =>
[payment_link_id] =>
)
// if there is no payment data for any payment id provided in input or any error will return null.
// update payment data based on payment update data and payment_id.
update_payment($payment, $payment_id);
// The filter callback function is based on the filter.
add_filter( ‘before_update_payment’, ‘before_update_payment_callback_fun’, 10, 1 );
function before_update_payment_callback_fun($payment, $payment_id) {
// code
}
// The filter callback function is based on the filter.
add_filter( ‘should_update_payment’, ‘should_update_payment_callback_fun’, 10, 1 );
function should_update_payment_callback_fun($payment, $payment_id) {
// code
}
// The filter callback function is based on the filter.
add_action('pre.update.payment', 'pre_update_payment_callback_fun', 10, 1);
function pre_update_payment_callback_fun($payment, $payment_id) {
// code
}
// The filter callback function is based on the filter.
add_action('post.update.payment', 'post_update_payment_callback_fun', 10, 1);
function post_update_payment_callback_fun($payment, $payment_id) {
// code
}
Response return mixed Either true or null if payment data is updated then true else null.
// The filter callback function is based on the filter.
add_filter( ‘before_get_payments’, ‘before_get_payments_callback_fun’, 10, 1 );
function before_get_payments_callback_fun($filter) {
// code
}
// The filter callback function is based on the filter.
add_filter( ‘should_get_payments’, ‘should_get_payments_callback_fun’, 10, 1 );
function should_get_payments_callback_fun($filter) {
// code
}
// The filter callback function is based on the filter.
add_action('pre.get.payments', 'pre_get_payments_callback_fun', 10, 1);
function pre_get_payments_callback_fun($filter) {
// code
}
// The filter callback function is based on the filter.
add_action('post.get.payments', 'post_get_payments_callback_fun', 10, 1);
function post_get_payments_callback_fun($filter) {
// code
}
// Retrieves payment data based on a filter array.
$payment_data = get_payments($filter);
// $response array includes following attributes:
// $response['user_id'] : the user_id of specific payment.
// $response['booking_id'] : the booking_id for specific payment.
// $response['cvc'] : the cvc for specific payment.
// $daresponseta['selling_date'] : the selling_date for specific payment.
// $response['company_id'] : the company_id for specific payment.
// $response['amount'] : the amount for specific payment.
// $response['customer_id'] : the customer_id for specific payment.
// $response['payment_type_id'] : the payment_type_id for specific payment.
// $response['description'] : the description for specific payment.
// $response['is_captured'] : the is_captured for specific payment.
// $response['selected_gateway'] : the selected_gateway for specific payment.
// $response['capture_payment_type'] : the capture_payment_type for specific payment.
// $response['folio_id'] : the folio_id for specific payment.
// and many more attributes for table payment and join with customer , user_profiles table.
// Successfully response giving you array of payment data.
Array
(
[0] => Array
(
[payment_id] => 2
[is_captured] => 0
[description] => good
[customer_name] => vishal solanki
[date_time] => 2022-01-26 17:23:03
[booking_id] => 1
[amount] => 0.00
[payment_status] => charge
[is_deleted] => 0
[payment_type] => AMEX
[payment_type_id] => 1
[payment_gateway_used] =>
[gateway_charge_id] =>
[read_only] =>
[selling_date] =>
[user_name] =>
[folio_id] =>
[payment_link_id] =>
)
)
// if there is no payment data for filter provided in input or any error will return null.
// delete a payment data from the payment table. it's a soft delete process only status will change data still existing in the backend database.
delete_payment($payment_id);
Response return mixed Either true or null if payment data is deleted then true
else null.