1. Home
  2. Documentation
  3. Example - Payment Management

Example - Payment Management

Check an integration example

In the context of a purchase in e-commerce, consider an integration that manages payment processing through the following steps:

Diagram

Flow diagram

Step Descriptions

Order received

The flow starts when an order is received with an identification code (ClientID).

A POST request is sent to the /simple endpoint.

The received response is logged.

Purchase information retrieval

With the ClientID, the system queries an internal service for more details.

A GET request is made to a purchase endpoint, passing the ClientID as a parameter.

The response is logged.

Data transformation

The information received is processed and formatted using the JSONata transformation tool.

The transformation applied is logged for verification.

IMPORTANT
  • Instructions for creating a new JSON object are in the "extractTotal.jsonata" file, available in the Resources folder.
  • The "extractTotal.jsonata" file is referenced in the flow script using "classpath" (see above).
  • See below for the contents of the "extractTotal.jsonata" file:

Payment processing

The processed data is sent to an external service to process the payment.

First, the transformed message body is converted to JSON format, and the Content-Type (set to application/json) and Authorization (with an example token) headers are set.

Then, a POST request is made to the payment endpoint.

The response is logged.

Status update

After payment processing, the result is combined with the ClientID and transformed again to update the payment status in an internal service.

The adjusted message body is converted to JSON format.

Finally, it is sent in a POST request to a status endpoint.

IMPORTANT
  • Instructions for creating a new JSON object are in the "statusPayload.jsonata" file, available in the Resources folder.
  • The "statusPayload.jsonata" file is referenced in the flow script using "classpath" (see above).
  • See below for the contents of the "statusPayload.jsonata" file:

Final response

The system sends a final confirmation indicating the payment was successful. The HTTP response code is set to 200, and the response body confirms the operation's success.

Additionally, the final response content is logged.

Source Code

See below the complete integration flow script:

How happy are you with this page?

We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more