This appears to be the way forward as far as I can tell:
We also need an additional field in the appointments table for validation.
We need a prepayment variable in the services table.
At step 4 an if statement is needed:
If Prepayment is Yes in the service table--the confirm button needs to be replaced with a payment button on click:
The validation column would be set with a time stamp in the future x minutes. This will stop the confirmation email. If the payment is not validated in x minutes the appointment is deleted. Also, the following standard paypal button format but it needs to be stripped to just a post statement on the click
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Item Name">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="0.00">
<input type="hidden" name="custom" value="E!A hash here">
</form>
All of this information for the values would be gathered from the services table and appointments table.
In the post to paypal we can include the appointment hash within the custom field. This would be our session ID that will send back to us.
In order to get payment verification we need an IPN listener built into EA. An examples of how to set up a listener are here:
A good video tutorial with code example is here:
We need to have PayPal Instant Payment Notification (IPN) activated with in PayPal. This was a little hard for me to find: In PayPal, go to Profile, in the left panel click "My Selling Tools", in the right pannel select update by "Instant Payment Notification (IPN)" and then, choose IPN settings. Then you enter a URL for the IPN listener.
That return URL would send back to us whether the purchase was verified or not along with the custom peramiter that carries the appointment's hash.
If verified with in the time limit:
Varification is set to Null
Email verification is sent
Else If not verified, the appointment is canceled with an invalid payment notice.
Else, the confirm button works as is.
Does anyone want to participate in making this?