Custom Gateway: Difference between revisions

Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 14: Line 14:
= Transfer to Custom Gateway =
= Transfer to Custom Gateway =


The post data is sent to the custom gateway as if it came from a normal HTML form being submitted
The post data is sent to the custom gateway with a POST method as if it came from a normal HTML form being submitted on a web page.


Both the URL and POST fields can contain template variables to include values from the booking.
Both the URL and POST fields can contain template variables to include values from the booking.
If the POST fields are empty, a GET request is made to the specified URL.


A special template variable [PAYMENTAMOUNT] will contain the value of the deposit when booking and the value of the payment request when used for payment requests.
A special template variable [PAYMENTAMOUNT] will contain the value of the deposit when booking and the value of the payment request when used for payment requests.


'''Example''': <code> deposit=[PAYMENTAMOUNT]&bookid={BOOKID]</code> will post fields deposit and bookid to the external gateway.
'''Example''': <code> deposit=[PAYMENTAMOUNT]&bookid=[BOOKID]</code> will post fields deposit and bookid to the external gateway.


*The custom gateway POST data is posted from the users browser when they click the pay button.
*The custom gateway POST data is posted from the users browser when they click the pay button.
*This means the POSTED data will be visible in the page source code and should not contain any secret or private data.
*This means the POSTED data will be visible in the page source code and should not contain any secret or private data.
= Confirmation Page =
The payment gateway should show the payment status to the booker confirming the success or failure of their payment.
After the booking (and sending the webhook to notify of payment success) the booker can be returned to the page booking.php?page=bookconfirmed which will show the booking they just made.
The booking is a stored in a session variable, which means that the confirmation page needs to be on the same domain as the booking otherwise it wont work or if it's in incognito mode and might time out after 15 minutes.


= Webhook to notify of payment status =
= Webhook to notify of payment status =
Line 31: Line 41:
The notify will add the deposit to the booking invoice and trigger updates to booking status and email notifications to guest and host.
The notify will add the deposit to the booking invoice and trigger updates to booking status and email notifications to guest and host.


The notify must post a key field with a value that matches to setting and contain at least 6 characters.
The notify must post a key value that matches the value in the key setting and contain at least 6 characters.


The data should be sent as HTML POST form data
The data should be sent as HTML POST form data
Line 46: Line 56:
These POST fields are optional:
These POST fields are optional:


<code>status</code> = booking status, 0 (cancelled), 1 (confirmed), 2 (new), 3 (request)
<code>status</code> = booking status, 0 (cancelled), 1 (confirmed), 2 (new), 3 (request) or -2 (nochange)


<code>amount</code> = amount of the deposit collected
<code>amount</code> = amount of the deposit collected