Pre-authorise a Payment

Pre-authorisation allows you to reserve funds on a customer's card for a period of time, before capturing the payment at a later date. This is available for both embedded (ecommerce) and payment links.

1. Authenticating against the API

you will need to authenticate against our api and get the bearer token, you can then use this for all future calls against the API.

You will need to get your public and private keys from the dashboard and them set these either in the environment or via another method.

import axios from 'axios'; const getToken = async () => { const response = await axios({ method: 'post', url: 'https://api.felloh.com/token', headers: { 'Content-Type': 'application/json' }, data: JSON.stringify({ public_key: process.env.PUBLIC_KEY, private_key: process.env.PRIVATE_KEY, }, ), }); return response.data.data; }; const { token } = await getToken();



More information on authentication can be found here.

2. Creating a pre-authorised payment link

By setting authorisation_only to true in the request, you are telling the API that you want to pre-authorise the payment. The same can be done for ecommerce (embedded) payments.

import axios from 'axios'; const response = await axios( { method: 'put', url: `https://api.felloh.com/agent/payment-links`, data : JSON.stringify({ customer_name: 'Tom Brady', email: 'tom@felloh.com', booking_id: '226009ab-ffe9-4c80-922b-982e8e7849f8', customer_id: 'cc15e9a7-21bf-4d55-b500-2a24c8e4ed1e', amount: 20000, currency: 'GBX', organisation: 'X1234', open_banking_enabled: true, card_enabled: true, description: 'Final payment for cruise holiday', expires_at: '2022-07-25', type: "UNKNOWN", authorisation_only: true, }, }), headers: { 'Content-Type': 'application/json', Authorization: `Bearer <YOUR TOKEN HERE>`, }, }, );



API documentation on creating payment links can be found here or alternatively ecommerce (embedded) payments can be found here.

3. Complete (Capture) the Transaction

To complete a transaction, you will need to make a GET request to the API, passing in the transaction ID. This will then complete the transaction and the funds will be taken from the customer.

import axios from 'axios'; const transactionID = '226009ab-ffe9-4c80-922b-982e8e7849f8'; const response = await axios( { method: 'get', url: `https://api.felloh.com/agent/transactions${transactionID}/complete`, headers: { 'Content-Type': 'application/json', Authorization: `Bearer <YOUR TOKEN HERE>`, }, }, );



API documentation on completing a transaction can be found here and reversing a transaction can be found here.