1. Home
  2. 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:

  1. Receiving the order
  2. Fetching purchase information
  3. Data transformation
  4. Payment processing
  5. Status update
  6. Final response

Diagram

Flow diagram

Step descriptions

See below the description of the steps:

Receiving the order

The flow starts when an order is received with an identification code (ClientID). The POST request is forwarded to the /simple endpoint. The response received is logged.

Fetching purchase information

With the ClientID, the system queries an internal service to get more details. The GET query is performed on a purchases endpoint, passing the ClientID as a parameter. The request response is logged.

Data transformation

The received information is processed and formatted using a transformation tool, JSONata. The applied transformation is logged for verification.

IMPORTANT:

  • The instructions to create 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 along with the classpath (snippet above).
  • See below the content of the extractTotal.jsonata file:

Payment processing

The processed data is then sent to an external service to make the payment. First, the transformed message body is converted to JSON format, and the Content-Type headers (defined as application/json) and Authorization (with an example token) are configured. Then, a POST request is made to the payment endpoint. The response received 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 and sent in a POST request to a status endpoint.

IMPORTANT:

  • The instructions to create 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 along with the classpath (snippet above).
  • See below the content of the statusPayload.jsonata file:

Final response

The system sends a final confirmation to indicate that the payment was successful. The HTTP response code is set to 200, and the response body confirms the success of the operation. In addition, the content of the final response is logged.

Source Code

See below the complete script of the integration flow:

IMPORTANT: Advanced parameters of EIPs and components are not yet available in the steps configuration form in the Diagram tab. To add them, use the Source Code tab.

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