Skip to main content

Updating an Existing Trip

This guide shows you how to resume and update an existing trip and its associated service applications in Fluxir. This is useful for restoring draft applications, editing previously submitted data, or re-processing identity documents.

Workflow

1
Retrieve the Traveler

First, you need the traveler from the trip you need to update.


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>'

Retrieve the id to be used to find the service applications for this person.

2
Retrieve Traveler's Service Applications

With the person's unique identifier, you can retrieve this traveler's travel service applications. Use the personId query parameter shown below:

curl -L 'https://api.fluxir.com/api/app/travel-services?PersonId=<PERSON_ID>' \
-H 'Accept: text/plain' \
-H 'Authorization: Bearer <token>'

Now, you have access to this person's applications, and their related trips.

3
Find the Trip and Travel Application

You can use these to both retrieve the trip data, and each service application information:

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.

With these, you can see what information still needs to be filled, in case your customer hasn't yet presented all needed information.

4
Edit and Update the Service Application

Update the application with new or corrected field values. This can include both direct field inputs and updates from passport recognition or context merges.


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"
}'

The request body should include:

  • items: The updated document fields.
  • state: You can optionally move the application to ReadyForPayment, InReview, etc.

Refer to the Application Status reference for valid values.

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.

5
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.