Ecommerce
An ecommerce object allows you to take a payment via the SDK, it works much the same way as a ecommerce object.
The Ecommerce Object
{"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c","booking": {"id": "9a33a74f-1e3e-595d-b89f-9da87d289e05","email": "tom@felloh.org","customer_name": "Tom Jones","booking_reference": "FEL-00012","departure_date": null,"return_date": null,"created_at": "2021-11-17T15:10:37.589Z"},"customer": {"id": "cc15e9a7-21bf-4d55-b500-2a24c8e4ed1e","customer_name": "Tom Jones","email": "tom@felloh.org","address_1": "The Old Rectory","address_2": "Main Road","city": "Belton","county": "Lincolnshire","country": "United Kingdom","post_code": "NG32 2LW"},"email": "tom@felloh.org","methods": {"open_banking": true,"card": true},"amount": 100,"currency": "GBX","customer_name": "Tom Jones","transactions": [{"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c","amount": 100,"completed_at": "2021-11-17T15:11:37.581Z","created_at": "2021-11-17T15:11:37.581Z"}],"user": {"id": "e8c243ff-d000-4f81-ba57-94184d44dae2","email": "tom@felloh.com"},"organisation": {"id": "X9876","name": "Felloh"},"expires_at": "2021-12-17T15:10:37.589Z","created_at": "2021-11-17T15:10:37.589Z"}
The compact ecommerce object object
{"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c","amount": 100,"currency": "GBX","expires_at": "2021-12-17T15:10:37.589Z","created_at": "2021-11-17T15:10:37.589Z"}
idstring
Unique identifier for the object
bookingobject
The booking object that the ecommerce object is linked to
customerobject
The customer object that the ecommerce object is linked to
emailstring
The email address of the payee
methods.open_bankingboolean
Whether the customer will be presented with the option to pay by open banking
methods.cardboolean
Whether the customer will be presented with the option to pay by card
amountnumber
The amount that the customer should be charged, in its lowest denomination (for GBP, this would be pence)
currencystring
The currency that the ecommerce object will be charged in | see currency documentation
customer_namestring
The name of the customer that the ecommerce object is for
transactionsarray
An array containing any compact transaction objects created using the ecommerce object
userobject
The compact user object of the user that created the booking
organisationobject
A compact organisation object representing the organisation owner of the ecommerce object.
created_atdatetime
The datetime at which the ecommerce object was created within our systems
expires_atdatetime
The datetime at which the ecommerce object will no longer be usable by a customer
Fetch all
POST/agent/ecommerce
import axios from 'axios';const response = await axios({method: 'post',url: 'https://api.felloh.com/agent/ecommerce',data: {organisation: 'X9876',keyword: 'james.dean@gmail.com',date_from: '2020-02-01',date_to: '2021-05-10',skip: 10,take: 20},headers: {'Content-Type': 'application/json',Authorization: `Bearer <YOUR TOKEN HERE>`,},},);
RESPONSE
{"data": [{"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c","booking": {"id": "9a33a74f-1e3e-595d-b89f-9da87d289e05","email": "tom@felloh.org","customer_name": "Tom Jones","booking_reference": "FEL-00012","departure_date": null,"return_date": null,"created_at": "2021-11-17T15:10:37.589Z"},"customer": {"id": "cc15e9a7-21bf-4d55-b500-2a24c8e4ed1e","customer_name": "Tom Jones","email": "tom@felloh.org","address_1": "The Old Rectory","address_2": "Main Road","city": "Belton","county": "Lincolnshire","country": "United Kingdom","post_code": "NG32 2LW"},"email": "tom@felloh.org","methods": {"open_banking": true,"card": true},"amount": 100,"currency": "GBX","customer_name": "Tom Jones","transactions": [{"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c","amount": 100,"completed_at": "2021-11-17T15:11:37.581Z","created_at": "2021-11-17T15:11:37.581Z"}],"user": {"id": "e8c243ff-d000-4f81-ba57-94184d44dae2","email": "tom@felloh.com"},"organisation": {"id": "X9876","name": "Felloh"},"expires_at": "2021-12-17T15:10:37.589Z","created_at": "2021-11-17T15:10:37.589Z"}],"errors": {},"meta": {"code": 200,"reason": "OK","message": "The request was successful","request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6","count": 1}}
This endpoint retrieves all ecommerce objects. Objects are sorted by creation date by default, with the most recent ecommerce objects coming first.
HTTP Method
POST
HTTP Endpoint
PRODhttps://api.felloh.com/agent/ecommerce
SANDBOXhttps://sandbox.felloh.com/agent/ecommerce
Payload
Parameter | Required | Type | Description |
---|---|---|---|
organisation | true | string | The organisation ID that you want to fetch ecommerce objects for. You can find the organisation that you have access to by using the List all organisations method. |
keyword | false | string | A customer name, booking reference or email address that you want to filter by. |
skip | false | Integer | See pagination section for details |
take | false | Integer | See pagination section for details |
show-child-organisations | fasle | Boolean | Whether to also show ecommerce objects for any of the requested organisations child organisations |
date_from | false | date | The creation date that you want to get ecommerce objects from, in ISO 8601 format |
date_to | false | date | The creation date that you want to get ecommerce objects to, in ISO 8601 format |
Response
Returns an array of ecommerce objects
Fetch one
GET/agent/ecommerce/226009ab-ffe9-4c80-922b-982e8e7849f8
import axios from 'axios';const ecommerceID = '226009ab-ffe9-4c80-922b-982e8e7849f8';const response = await axios({method: 'get',url: `https://api.felloh.com/agent/ecommerce/${ecommerceID}`,headers: {'Content-Type': 'application/json',Authorization: `Bearer <YOUR TOKEN HERE>`,},},);
RESPONSE
{"data": {"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c","booking": {"id": "9a33a74f-1e3e-595d-b89f-9da87d289e05","email": "tom@felloh.org","customer_name": "Tom Jones","booking_reference": "FEL-00012","departure_date": null,"return_date": null,"created_at": "2021-11-17T15:10:37.589Z"},"customer": {"id": "cc15e9a7-21bf-4d55-b500-2a24c8e4ed1e","customer_name": "Tom Jones","email": "tom@felloh.org","address_1": "The Old Rectory","address_2": "Main Road","city": "Belton","county": "Lincolnshire","country": "United Kingdom","post_code": "NG32 2LW"},"email": "tom@felloh.org","methods": {"open_banking": true,"card": true},"amount": 100,"currency": "GBX","customer_name": "Tom Jones","transactions": [{"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c","amount": 100,"completed_at": "2021-11-17T15:11:37.581Z","created_at": "2021-11-17T15:11:37.581Z"}],"user": {"id": "e8c243ff-d000-4f81-ba57-94184d44dae2","email": "tom@felloh.com"},"organisation": {"id": "X9876","name": "Felloh"},"expires_at": "2021-12-17T15:10:37.589Z","created_at": "2021-11-17T15:10:37.589Z"},"errors": {},"meta": {"code": 200,"reason": "OK","message": "The request was successful","request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6"}}
This endpoint allows you to retrieve a single ecommerce object
HTTP Method
GET
HTTP Endpoint
PRODhttps://api.felloh.com/agent/ecommerce/<ECOMMERCE ID>
SANDBOXhttps://sandbox.felloh.com/agent/ecommerce/<ECOMMERCE ID>
Path Parameters
Parameter | Required | Type | Description |
---|---|---|---|
id | true | UUID | The ecommerce object id that you wish to retrieve |
Response
Returns a Ecommerce Object
Delete one
DELETE/agent/ecommerce/226009ab-ffe9-4c80-922b-982e8e7849f8
import axios from 'axios';const ecommerceID = '226009ab-ffe9-4c80-922b-982e8e7849f8';const response = await axios({method: 'delete',url: `https://api.felloh.com/agent/ecommerce/${ecommerceID}`,headers: {'Content-Type': 'application/json',Authorization: `Bearer <YOUR TOKEN HERE>`,},},);
RESPONSE
{"data": {},"errors": {},"meta": {"code": 200,"reason": "OK","message": "The request was successful","request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6"}}
This endpoint allows you to delete a single ecommerce object
HTTP Method
DELETE
HTTP Endpoint
PRODhttps://api.felloh.com/agent/ecommerce/<ECOMMERCE ID>
SANDBOXhttps://sandbox.felloh.com/agent/ecommerce/<ECOMMERCE ID>
Path Parameters
Parameter | Required | Type | Description |
---|---|---|---|
id | true | UUID | The ecommerce object id that you wish to delete |
Create one
PUT/agent/ecommerce/
import axios from 'axios';const response = await axios({method: 'put',url: `https://api.felloh.com/agent/ecommerce`,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,expires_at: '2022-07-25',surcharging_enabled: true,excluded_card_types: ["AMEX"],excluded_card_regions: ["INTER"],}),headers: {'Content-Type': 'application/json',Authorization: `Bearer <YOUR TOKEN HERE>`,},},);
RESPONSE
{"data": {"id": "226009ab-ffe9-4c80-922b-982e8e7849f8",},"errors": {},"meta": {"code": 200,"reason": "OK","message": "The request was successful","request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6"}}
This endpoint allows you to create a new ecommerce object
HTTP Method
PUT
HTTP Endpoint
PRODhttps://api.felloh.com/agent/ecommerce
SANDBOXhttps://sandbox.felloh.com/agent/ecommerce
Payload
Parameter | Required | Type | Description |
---|---|---|---|
customer_name | true | string | The customers full name. |
true | string | The customers email address | |
organisation | true | string | The organisation ID that you want to create the ecommerce object in. |
booking_id | false | string | The booking ID that you want to assign the ecommerce object to. This can be assigned later if you wish. |
customer_id | false | string | The customer ID that you want to attach the payment link to. This is only required if you want to autofill the address fields on the card payment form. |
amount | true | integer | The value that you want to charge the customer |
open_banking_enabled | false | bool | Whether to allow the customer to pay via open banking |
card_enabled | false | bool | Whether to allow the customer to pay via card |
expires_at | false | date | The date that the ecommerce object will expire, defaults to 30 days from date created. |
currency | false | string | The currency that transactions will be undertaken in, defaults to GBX, see currency documentation for more information. |
authorisation_only | false | bool | Whether to only authorise the payment (preauth), and not capture it. Defaults to false. |
surcharging_enabled | false | bool | Wether surcharging is enabled for the payment (if surcharging is enabled for organisation). Defaults to true |
excluded_card_types | false | array | Whether certain card types should be blocked for payment, options to exclude are - AMEX, VISA, MASTER. |
excluded_card_regions | false | array | Whether certain card regions should be blocked for payment, options to exclude are - DOMESTIC, INTER, INTRA. |
Response
Parameter | Type | Description |
---|---|---|
id | UUID | The ID of the ecommerce object that you have created |
Assign to booking
POST/agent/ecommerce/{ecommerce_id}/assign
import axios from 'axios';const ecommerceID = '226009ab-ffe9-4c80-922b-982e8e7849f8';const bookingID = '226009ab-ffe9-4c80-922b-982e8e7849f8';const response = await axios({method: 'post',url: `https://api.felloh.com/agent/ecommerce/${ecommerceID}/assign`,data : JSON.stringify({booking_id: bookingID,}),headers: {'Content-Type': 'application/json',Authorization: `Bearer <YOUR TOKEN HERE>`,},},);
RESPONSE
{"data": {},"errors": {},"meta": {"code": 200,"reason": "OK","message": "The request was successful","request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6"}}
This endpoint allows you to assign a ecommerce object to a booking
HTTP Method
POST
HTTP Endpoint
PRODhttps://api.felloh.com/agent/ecommerce/{ecommerce_id}/assign
SANDBOXhttps://sandbox.felloh.com/agent/ecommerce/{ecommerce_id}/assign
Payload
Parameter | Required | Type | Description |
---|---|---|---|
booking_id | false | string | The booking ID that you want to assign the ecommerce object to. |