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:
// The filter callback function is based on the filter.add_action('pre.add.payment','pre_add_payment_callback_fun',10,1);functionpre_add_payment_callback_fun($payment) {// code}
hook name: post.add.payment
Description: This hook would be executed after add payment into the database in add_payment helper.
Usage:
// The filter callback function is based on the filter.add_action('post.add.payment','post_add_payment_callback_fun',10,1);functionpost_add_payment_callback_fun($payment) {// code}
Usage
// 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);
Request Parameters
Parameters in array format includes following attributes:
Response
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.
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:
// The filter callback function is based on the filter.add_filter( ‘before_get_payment’, ‘before_get_payment_callback_fun’,10,1);functionbefore_get_payment_callback_fun($payment_id) {// code}
Filter name: should_get_paymentDescription: This filter would be executed before retrieving payment details from database in get_payment helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_get_payment’, ‘should_get_payment_callback_fun’,10,1);functionshould_get_payment_callback_fun($payment_id) {// code}
hook name: pre.get.payment
Description: This hook would be executed before retrieving payment details from database in get_payment helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.get.payment','pre_get_payment_callback_fun',10,1);functionpre_get_payment_callback_fun($payment_id) {// code}
hook name: post.get.payment
Description: This hook would be executed after retrieving payment details from database in get_payment helper.
Usage:
// The filter callback function is based on the filter.add_action('post.get.payment','post_get_payment_callback_fun',10,1);functionpost_get_payment_callback_fun($payment_id) {// code}
Usage
// Retrieves payment data based on a payment_id.$payment_data =get_payment($payment_id);
Request Parameters
Response
// $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-2617: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.
function update_payment($payment, $payment_id) {....}
Usage
// update payment data based on payment update data and payment_id.update_payment($payment, $payment_id);
Supported hooks
Filter name: before_update_paymentDescription: This filter would be executed before updatepayment into the database in update_payment helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_update_payment’, ‘before_update_payment_callback_fun’,10,1);functionbefore_update_payment_callback_fun($payment, $payment_id) {// code}
Filter name: should_update_paymentDescription: This filter would be executed before update payment into database in update_payment helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_update_payment’, ‘should_update_payment_callback_fun’,10,1);functionshould_update_payment_callback_fun($payment, $payment_id) {// code}
hook name: pre.update.payment
Description: This hook would be executed before update payment into the database in update_payment helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.update.payment','pre_update_payment_callback_fun',10,1);functionpre_update_payment_callback_fun($payment, $payment_id) {// code}
hook name: post.update.payment
Description: This hook would be executed after update payment into the database in update_payment helper.
Usage:
// The filter callback function is based on the filter.add_action('post.update.payment','post_update_payment_callback_fun',10,1);functionpost_update_payment_callback_fun($payment, $payment_id) {// code}
Request Parameters
Request required payment_id and array format data includes following attributes:
Response
Response return mixed Either true or null if payment data is updated then true else null.
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:
// The filter callback function is based on the filter.add_filter( ‘before_get_payments’, ‘before_get_payments_callback_fun’,10,1);functionbefore_get_payments_callback_fun($filter) {// code}
Filter name: should_get_paymentsDescription: This filter would be executed before retrieving payment details from database in get_payments helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_get_payments’, ‘should_get_payments_callback_fun’,10,1);functionshould_get_payments_callback_fun($filter) {// code}
hook name: pre.get.payments
Description: This hook would be executed before retrieving payment details from database in get_payments helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.get.payments','pre_get_payments_callback_fun',10,1);functionpre_get_payments_callback_fun($filter) {// code}
hook name: post.get.payments
Description: This hook would be executed after retrieving payment details from database in get_payments helper.
Usage:
// The filter callback function is based on the filter.add_action('post.get.payments','post_get_payments_callback_fun',10,1);functionpost_get_payments_callback_fun($filter) {// code}
Usage
// Retrieves payment data based on a filter array.$payment_data =get_payments($filter);
Request Parameters
parameter array filter required for payment details.
Response
// $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-2617: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.
function delete_payment($payment_id) {.....}
Usage
// 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);
Request Parameters
Response
Response return mixed Either true or null if payment data is deleted then true
else null.