Difference between revisions of "Custom Gateway"

From Beds24 Wiki
Jump to navigation Jump to search
Beds24>Markkinchin
 
m (1 revision imported)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[Category:Payments]]
 +
[[Category:Payment_Gateways]]
 +
<div class="heading">Custom Gateway</div>
 +
This page is about the menu SETTINGS->PAYMENTS->PAYMENT GATEWAYS->CUSTOM GATEWAY and explains how to connect with a payment gateway of your choice.
  
[[Category:Payment_Collection]]
+
<span style="color: #f3e504; font-size: 250%;" >{{#fas:lightbulb}} </span> Required skills: html, programming
''This page is about the menu SETTINGS->PROPERTIES->PAYMENT COLLECTION->CUSTOM GATEWAY''
+
__TOC__
 
+
= Introduction =
Required skills: html, programming
 
  
 
You can create an interface to an external (not integrated) payment gateway.
 
You can create an interface to an external (not integrated) payment gateway.
  
 
The booker will be shown a button which will take them to the specified URL with the value from "Post Data" included as an HTML POST.
 
The booker will be shown a button which will take them to the specified URL with the value from "Post Data" included as an HTML POST.
 +
 +
= Transfer to Custom Gateway =
 +
 +
The post data is sent to the custom gateway as if it came from a normal HTML form being submitted
  
 
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.
Line 13: Line 20:
 
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.
  
i.e. deposit=[PAYMENTAMOUNT]&bookid={BOOKID] 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.
 +
*This means the POSTED data will be visible in the page source code and should not contain any secret or private data.
 +
 
 +
= Webhook to notify of payment status =
  
 
A notify URL is available for the external gateway to report a successful collection of the deposit.
 
A notify URL is available for the external gateway to report a successful collection of the deposit.
Line 21: Line 33:
 
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 field with a value that matches to setting and contain at least 6 characters.
  
Notify URL https://api.beds24.com/custompaymentgateway/notify.php
+
The data should be sent as HTML POST form data
 +
 
 +
Notify URL: https://api.beds24.com/custompaymentgateway/notify.php
 +
 +
 
 +
The notify should contain the following POST fields:
 
   
 
   
 +
<code>key</code>= value in custom gateway key setting
 +
 +
<code>bookid</code> = the bookid of the booking
 +
 +
These POST fields are optional:
 +
 +
<code>status</code> = booking status, 0 (cancelled), 1 (confirmed), 2 (new), 3 (request)
 +
 +
<code>amount</code> = amount of the deposit collected
 +
 +
<code>description</code> = description of payment for invoice item
 +
 +
<code>payment_status</code> = status of payment for invoice item
 +
 +
<code>txnid</code> = unique id for this payment to prevent false duplicates
 +
 +
 +
A success will have HTTP 200 response with no text.
 +
If there is any text content in the response, it will be an error message which means it was not successful.
  
The notify should contain the following POST fields:
+
= Payment gateways with specific requirements =
key = value in custom gateway key setting
+
The payment values can be first posted to your server.
bookid = the bookid of the booking
+
Your server can process the data and convert it into the format required by the payment gateway.
 +
Finally redirecting the guest to the payment gateway with the data in the required format.
  
These POST fields are optional:
+
Examples where this may be required are adding authorization headers or passwords or transforming the data into a specific format required by the payment gateway.
status = booking status, 0 (cancelled), 1 (confirmed), 2 (new), 3 (request)
 
amount = amount of the deposit collected
 
description = description of payment for invoice item
 
payment_status = status of payment for invoice item
 
txnid = unique id for this payment to prevent false duplicates
 

Latest revision as of 01:33, 19 May 2021

Custom Gateway
This page is about the menu SETTINGS->PAYMENTS->PAYMENT GATEWAYS->CUSTOM GATEWAY and explains how to connect with a payment gateway of your choice.

{{#fas:lightbulb}} Required skills: html, programming

Introduction

You can create an interface to an external (not integrated) payment gateway.

The booker will be shown a button which will take them to the specified URL with the value from "Post Data" included as an HTML POST.

Transfer to Custom Gateway

The post data is sent to the custom gateway as if it came from a normal HTML form being submitted

Both the URL and POST fields can contain template variables to include values from the booking.

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: deposit=[PAYMENTAMOUNT]&bookid={BOOKID] 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.
  • This means the POSTED data will be visible in the page source code and should not contain any secret or private data.

Webhook to notify of payment status

A notify URL is available for the external gateway to report a successful collection of the deposit.

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 data should be sent as HTML POST form data

Notify URL: https://api.beds24.com/custompaymentgateway/notify.php


The notify should contain the following POST fields:

key= value in custom gateway key setting

bookid = the bookid of the booking

These POST fields are optional:

status = booking status, 0 (cancelled), 1 (confirmed), 2 (new), 3 (request)

amount = amount of the deposit collected

description = description of payment for invoice item

payment_status = status of payment for invoice item

txnid = unique id for this payment to prevent false duplicates


A success will have HTTP 200 response with no text. If there is any text content in the response, it will be an error message which means it was not successful.

Payment gateways with specific requirements

The payment values can be first posted to your server. Your server can process the data and convert it into the format required by the payment gateway. Finally redirecting the guest to the payment gateway with the data in the required format.

Examples where this may be required are adding authorization headers or passwords or transforming the data into a specific format required by the payment gateway.