Schedule a Payment

In order to schedule a payment for your customer, you will need to follow a series of steps. This guide assumes that you already have a booking for your customer with a tokenised card attached. The steps are as follows:

1. Authenticating

You first need to authenticate and get the bearer token, which will be used for all subsequent API calls.

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. Finding Card Tokens Associated with a Booking

Once you have the authentication token, you can retrieve the card tokens associated with a booking. This is essential if you need to schedule a payment using a saved card.

import axios from 'axios'; const bookingId = 'd8529e8d-dbfd-41fc-bc35-71bbe91ab719'; const response = await axios.get( `https://api.felloh.com/payment/booking/${bookingId}/available-tokens`, { headers: { 'Authorization': `Bearer <YOUR TOKEN HERE>` } } ); console.log(response.data);



More information on this endpoint can be found here.

3. Scheduling a Payment

After you've retrieved the card tokens, you can proceed with scheduling a payment. The booking ID is passed in the URL, and the card token (the id of one of the tokenised cards returned in step 2), the amount and the date to take the payment (ISO 8601) are passed in the body.

On success the endpoint returns an empty data object.

const token = 'YOUR TOKEN HERE (FROM STEP 1)'; const bookingId = 'd8529e8d-dbfd-41fc-bc35-71bbe91ab719'; const cardToken = 'CARD TOKEN ID HERE (FROM STEP 2)'; const amount = 2500; // Amount in minor units (e.g., pence) const date = '2025-03-29T00:00:00.000Z'; const response = await axios.post( `https://api.felloh.com/payment/booking/${bookingId}/payment`, { token: cardToken, amount: amount, date: date, }, { headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json', }, } ); console.log(response.data);



More information on this endpoint can be found here