Skip to main content

Creating a New Trip

This tutorial shows you how to create and submit a service application for a new trip in Fluxir. It guides you through the process of creating a new service application in Fluxir.

Workflow

1
Retrieve Service Intents

Send a POST request to retrieve service intents for a specific trip context:

Supported Countries

Use the Get all supported countries for trip planning or refer to the Supported Countries for a list of countries available for planning a trip.


curl -X POST 'https://api.fluxir.com/api/app/travel-services/service-intents' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H 'X-Tenant: <YOUR_TENANT_ID>' \
--data-raw '{
"serviceTypesFilter": [],
"tripContext": {
"items": {
"system.tripFrom": "2025-07-30",
"system.tripTo": "2025-08-20",
"system.tripOrigination": "JOR",
"system.tripDestination": "ARE"
},
"travelerContexts": []
},
"inputRestrictionMode": "ByPassOnMissing",
"continuationToken": ""
}'

The response will be an array of available service intents for the defined trip context. Select a service intent to be used in the next steps.

2
Fetch Documents Scheme

This request will retrieve the data you'll need to fill for the chosen service. You need the documentSchemeVersionId from the service intent selected on Step 1.


curl -X GET 'https://api.fluxir.com/api/app/documents-scheme/?visaSchemeVersionId=<VERSION_ID>&normalized=true' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en' \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H 'X-Tenant: <YOUR_TENANT_ID>'

This response will present you with the needed information to create a travel service application (Step 5).

Here, you'll find the information your customer needs to provide for the chosen service. This is found in the items key of the response, which is an array of objects.

3
Create Trip

Create a new trip.


curl -X POST 'https://api.fluxir.com/api/app/trip' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H 'X-Tenant: <YOUR_TENANT_ID>' \
--data-raw '{
"originationCode": "JOR",
"destinatonCode": "ARE",
"description": null,
"visaApplicationIds": null,
"notes": null,
"from": "2025-07-30",
"to": "2025-08-20"
}'

You will later (Step 5) connect the Travel Service Application you create to this trip.

4
List Available Travelers

Retrieve a list of available travelers to select the person that will be connected to the trip.


curl -X GET 'https://api.fluxir.com/api/app/persons?skipCount=0&maxResultCount=15&descending=false' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en' \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H 'X-Tenant: <YOUR_TENANT_ID>'

This endpoint returns a list of previously created travelers. You need to select the person you want to use, and extract the id to be used in the (next step).

Creating a new traveler

Instead of choosing an existing traveler, you can create a new one. To create a new traveler, use the following endpoint:

Create a New Person

POST
5
Create Travel Service Application

Now, you need to create the travel service application, following the instructions below:

  • From step 1, add the documentVersionId from the selected service intent.

  • From step 2, use the items array information filled by your customer to send the needed information to create the travel service application.

  • From step 3, use the trip's id in the tripId field to link the application to the trip.

    Service Application Limits

    A trip cannot contain multiple service applications of the same type for the same traveler.
    For example, you cannot add two insurance policies or two visa applications for the same person within a single trip.

    However, the same service type can be applied to different travelers in the same trip.

  • From step 4, use the traveler's id in the personId field to link the application to the traveler.


curl -X POST 'https://api.fluxir.com/api/app/travel-services' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H 'X-Tenant: <YOUR_TENANT_ID>' \
--data-raw '{
"serviceType": "Insurance",
"providerName": "TamkeenInsurance",
"serviceIntentKey": "Insurance-TamkeenInsurance-PlanA",
"personId": <PERSON_ID_FROM_STEP_4>,
"tripId": <TRIP_ID_FROM_STEP_3>,
"documentVersionId": <DOCUMENT_VERSION_ID_FROM_STEP_1>,
"items": {
<LIST_OF_ITEMS_FROM_STEP_2>
},
"state": "Draft",
"serviceTypeId": null
}'
Adding a New Service Application to a Trip

If you want to add a service application of a new type that hasn't been added to the trip yet,
you must first perform a service intent search to obtain the relevant serviceIntentKey and documentVersionId.

These values are required to correctly create the service application for the selected service type.

Recognize Identity Documents (Optional)

If a new identity document is needed or an existing one should be updated, follow these steps:

These endpoints allow you to recognize document data from an image and store it as structured identity information.

6
Updating the Travel Service Application

If the customer still needs to update their information, or if you need to change the application status, you will need to update the Travel Service Application. You'll use the following endpoint to update it:


curl -X PATCH '/api/app/travel-services/<TRAVEL_SERVICE_ID>' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H 'X-Tenant: <YOUR_TENANT_ID>' \
--data-raw '{
"state": "Draft",
"items": {
"passportNumber": "569569595",
"nameEnglish": "John Doe",
"dateOfBirth": "1991-05-29",
"gender": "gender.male",
},
"state": "ReadyForPayment"
}'
Possible Statuses

Refer to the Application Status reference page for a list of possible statuses an application can have.

7
Checkout Process

After the travel status is ready for payment, you need to present the customer with the payment URL, and, after they pay, let the system now the checkout is finalized.

  1. Retrieve the checkout URL, using the tripId:


    curl -X GET "https://api.fluxir.com/api/app/trip/<TRIP_ID>/checkout?serviceApplicationIds=<SERVICE_APP_IDS>&successUrl=<URL_ENCODED_SUCCESS_URL>&cancelUrl=<URL_ENCODED_CANCEL_URL>" \
    -H 'Accept: application/json, text/plain, */*' \
    -H 'Accept-Language: en' \
    -H "Authorization: Bearer <ACCESS_TOKEN>" \
    -H 'X-Tenant: <YOUR_TENANT_ID>'

    Attach the result value with the following Stripe URL:

    https://checkout.stripe.com/c/pay/cs_test_a1weSayiHvw9a8gVV6cIuICiZ48zcOg8RA5slLBHGXp9NAUir1DkWF9WAw

    After you receive the checkout URL from the response, redirect your user there and let them complete payment.

  2. Once the user is redirected to your successUrl, wait for at least 5 seconds, and make a request to the Finalize checkout endpoint to complete the process.


    curl -X POST "https://api.fluxir.com/api/app/trip/<TRIP_ID>/finalize-checkout" \
    -H 'Accept: application/json, text/plain, */*' \
    -H 'Accept-Language: en' \
    -H "Authorization: Bearer <ACCESS_TOKEN>" \
    -H 'X-Tenant: <YOUR_TENANT_ID>' \
    --data-raw ''
Placeholders

Remember to replace the placeholder values in the requests above before making real requests.