There are 2 main places where you should add your code when adding a new payment gateway:
The places where you put the pay now buttons and send requests to the payment processor servers.
A new page where the processor server will send the response to your transaction (accepted, rejected etc).

Where to add the payment buttons

Depending on the payment type you chose the “pay now” buttons can be put in 2 places.

Important : when sending the request to the payment server you also need to send what type of transaction you are doing.  For example if you are doing a membership payment you need to send a a variable like is_membership along with the required data. The processor should also return this variable in the processor page and yu would be able to know if the transaction is a membership payment or a booking payment and act accordingly.

1. User Dashboard Page Sidebar 

In this case the file is user_membership_profile.php  and you should add your code around line 64 . Here is the code where paypal, stripe or pay by wire buttons are added.

if($enable_paypal_status==='yes'){
print '<div id="pick_pack"></div>';
}
if($enable_stripe_status==='yes'){
wpestate_show_stripe_form_membership();
}

if($enable_direct_status==='yes'){
print '<div id="direct_pay" class="wpb_button wpb_btn-info wpb_btn-large">'.__('Wire Transfer','wpestate').'</div>';
}

2. Property unit in dashboard – in case you are using  per submission payments

In this case the buy now buttons should be placed in dashboard_listing_unit.php around line 181.  As you can see in the code , first we check if the payment is in membership mode

the actual buttons are around line 195 or line 219 ( there is a if to check if a the listing is already published but not featured)

if($enable_paypal_status==='yes'){
$stripe_class=' stripe_paypal ';
print '

'.__('Pay with Paypal','wpestate').'

';
}

if($enable_stripe_status==='yes'){
wpestate_show_stripe_form_per_listing($stripe_class,$post_id,$price_submission,$price_featured_submission);
}
if($enable_direct_status=='yes'){
print '

'.__('Wire Transfer','wpestate').'

';
}

The “processor” page.

For each new payment processor you should create a new page template and in there  you should check the the transaction response.

For example , for stripe we have the stripecharge.php page template. When we setup Stripe, beside adding a api keys a user must also create a new page with the template “Stripe Charge Pay”. The he will use this link as the return page for the Stripe setup.

So, for your new processor do the following

create a template new_processor.php
add in header  the following
// Template Name: New Processor Charge Page
// Wp Estate Pack

Create a page with the new template and use that as the “return url” for the new merchant.

In the actual processor page

Here you should check if the transaction is valid and if yes – validate the transaction.  All the merchants have sample code for check this answers and you should start from their code.

In case the transaction is a submission payment the code is at line 157


if ( isset ($_POST['submission_pay'])  && $_POST['submission_pay']==1  )

Important points in this case :

insert the invoice with wpestate_insert_invoice .

$invoice_id = wpestate_insert_invoice('Upgrade to Featured','One Time',$listing_id,$date,$current_user->ID,0,1,'' );

update the invoice status with 

update_post_meta($invoice_id, 'pay_status', 1);

publish the new listing if is the case –

$post = array(
'ID' => $listing_id,
'post_status' => 'publish'
);
$post_id = wp_update_post($post );

In case the transaction is a recurring payment for membership the code is at line 247

Important points in this case :

check if the new package has fewer listings that the current pack with wpestate_check_downgrade_situation. If yes – use
wpestate_downgrade_to_pack()

Upgrade the membership with
 wpestate_upgrade_user_membership($current_user-&gt;ID,$pack_id,2,'');

 In case the transaction is a payment for membership the code is at line 309

Important points in this case :

check if the new package has fewer listings that the current pack with wpestate_check_downgrade_situation. If yes – use
wpestate_downgrade_to_pack()

Upgrade the membership with  
wpestate_upgrade_user_membership($current_user-&gt;ID,$pack_id,2,'');

If you need additional explanations about how to implement the merchant please post a ticket at support.wpestate.org and will update this document.