PayPal integration - who is interested?

767 views
Skip to first unread message

Rene

unread,
Sep 4, 2016, 12:01:51 PM9/4/16
to Easy!Appointments - Support Group
Dear community,

For a project I need to have a proper PayPal integration into E!A. Means, if you choose a paid service you will need to process a payment via PayPal to get the appointment booked.

I spoke with Alex the developer of E!A and he would do it as a freelance job. Unfortunately his price is a bit too high for our use case.

If someone is interested in the PayPal integration, too, and willing to join in, please send me a message.

I'll keep the post updated so that everyone knows how many actually join. The more join in, the cheaper it will become for everyone!

Message has been deleted

Craig Tucker

unread,
Sep 22, 2016, 3:29:35 AM9/22/16
to Easy!Appointments - Support Group
A nice explanation of how to do it is found here:

It looks easier than I was originally thinking.

Craig Tucker

unread,
Sep 22, 2016, 3:48:07 AM9/22/16
to Easy!Appointments - Support Group
So, it looks like what needs to be done is on step 4 of EA, 
  • add a PayPal button with some JS that grabs the service and price variable to send to PayPal
  • grey out and disable or hide the submit button until the return url with Instant Payment Notification is hit from PayPal
  • add a function to handle the Instant Payment Notification post from PayPal and . . .
  • enable the submit button with the PayPal Instant Payment Notification Post
I wish I had time to do this.  It looks really doable with a moderate level of skill.  We would just be adding some HTML and JS to step 4.  

What would be nice as well is to use a global variable to turn on or off the PayPal option in the EA config file.

Rene

unread,
Sep 26, 2016, 5:54:31 AM9/26/16
to Easy!Appointments - Support Group
Hi Craig,

thank you for your replay.

My fist try was just to add a pay now button. Checking on the confirmation page if it is a pay service and if yes append to a added div (#paynow) to "book_success.php" the Paypal pay now button. That was working but the client gets the appointment confirmed without necessarily processing an verifying the payment.

Following the code sniped how I made it in "frontend_book_success.js".

$(document).ready(function() {
 
 
/*
  show paypal button
  */

 
 
if (GlobalVariables.serviceData['price']  > 0) {   $('#paynow').append(

     
'<p><br><br>Bitte bezahlen Sie jetzt hier!' +
     
'<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">' +
     
// '<input type="hidden" name="cmd" value="_s-xclick">' +
     
'<input type="hidden" name="cmd" value="_xclick">' +
     
// '<input type="hidden" name="hosted_button_id" value=" ### add you id ###">' +
     
'<input type="hidden" name="business" value="### add you business ###">' +
     
'<input type="hidden" name="lc" value="DE">' +
     
'<input type="hidden" name="item_name" value="' + GlobalVariables.serviceData['name'] + '">' +
     
'<input type="hidden" name="amount" value="' + GlobalVariables.serviceData['price'] + '">' +
     
'<input type="hidden" name="currency_code" value="EUR">' +
     
'<input type="hidden" name="button_subtype" value="services">' +
     
'<input type="hidden" name="no_note" value="0">' +
     
'<input type="hidden" name="cn" value="Mitteilung:">' +
     
'<input type="hidden" name="no_shipping" value="1">' +
     
'<input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynowCC_LG.gif:NonHosted">' +
     
'<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal.">' +
     
'<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">' +
     
'</form>' +
     
'</p>');
 
}

 
....

In my current version I'm working with the PayPal PHP SDK (https://github.com/paypal/PayPal-PHP-SDK).
* depending if it is pay service or not you get a "confirm" or "pay now" button on step 4.
* by pressing pay now, a PayPal request will be generated an you will hand over to PayPal to do the payment
* at the same time, E!A saves the appointment to the database and sends the confirmations e-mails (thats at this time BAD)
* after payment has happened you will linked back to the booking page, incl. booking ID for a confirmation (no verification has been done)

Unfortunately I'm not able to get it work to send the mail confirmation after you are back from payment. I guess I need to save the appointment to the database on step 4 anyway and when we are back from Paypal sending the mail then otherwise deleting the database entry.

Do you have any advise how to postpone the sending of the confirmation e-mails? 


By the way: there is a great video-tutorial on codecourse.com on payments with PayPal https://www.codecourse.com/library/lessons/payments-with-paypal/payments-with-paypal

Craig Tucker

unread,
Oct 1, 2016, 2:16:09 AM10/1/16
to Easy!Appointments - Support Group
What comes to mind building on what you are doing (forgive me if you are already doing this)

I think you are looking to make changes in the following: 
  /application/controllers/appointments.php 

and modifying the following function
  public function ajax_register_appointment() 

And finding a way to pause before the heading:
    // :: SEND NOTIFICATION EMAILS TO BOTH CUSTOMER AND PROVIDER

And then resume after confirmation.  

Currently in EA Appointment Delete/Modification is initiated with the URL plus a hash for the appointment. This brings up the EA appointment front end with a cancelation box at the header. So we could modify the confirm url to include the hash preceded by CONFIRM such as:

<a href="'.$this->config->base_url(); ?>index.php/appointments/index/CONFIRM<?php echo $appointment_data['hash'].'"

Then in appointments.php near the statement 

if ($appointment_hash !== '')

we would need an if statement to handle the hash that starts with CONFIRM to continue the email in the associated entry.


You also want a way to delete the appointment if there is no confirmation.

The hash method could be modified for paypal cancellation.  Another function to just delete if the hash starts with CANCEL, so the return url would look something like 

<a href="'.$this->config->base_url(); ?>index.php/appointments/index/CANCEL<?php echo $appointment_data['hash'].'"

Then in appointments.php near the statement 

if ($appointment_hash !== '')

we would need an if statement to handle the hash that starts with CANCEL to delete the associated entry.

This is what comes to mind for me.  For what it is worth.

Thanks for working on this Rene

Romero Henrique

unread,
Apr 26, 2017, 1:28:11 PM4/26/17
to Easy!Appointments - Support Group
Im interested on this project and ill definitely support the project.
Reply all
Reply to author
Forward
0 new messages