Backend Development 9 min read

Design and Implementation of an External Gateway for Vehicle Payment System Integration

This article describes the background, design, configuration, encryption, mock data handling, and practical deployment steps of an external gateway that unifies and secures communication between internal vehicle payment services and external channels such as Apple Pay, Alipay, WeChat Pay, and UnionPay.

HomeTech
HomeTech
HomeTech
Design and Implementation of an External Gateway for Vehicle Payment System Integration

1. Project Background

The vehicle payment system needs to integrate with many external channels (Apple Pay, Alipay, WeChat, UnionPay). In practice, developers encounter issues such as the need for non‑business‑logic coordination with channels and the lack of unified outbound control across subsystems. An external gateway is introduced to ensure secure, efficient, and convenient communication between internal and external systems.

2. Design Solution

The gateway provides a visual interaction flow (see diagram) and works without writing code by configuring built‑in plugins for common protocols, signing, encryption, and data mapping. It also offers mock data capabilities when external interfaces are unavailable. Two integration methods are supported:

Clients using Spring Cloud can register with a unified Consul registry.

Other systems can call the gateway via standard HTTP.

3. Practice Process

After obtaining the partner’s API documentation, developers configure authentication, encryption, and routing parameters in the gateway’s management console, generating a template ID. Requests are then sent using the template ID plus the required parameters.

3.1 Group Management

Groups allow common configuration for a series of interfaces, covering signing, encryption, preset fields, etc.

3.2 Encryption Strategy

Supported encryption types include symmetric (AES, DES), asymmetric (RSA, DSA), and digest (MD5, SHA‑1, SHA‑256, HMAC). The following table lists algorithms and their descriptions:

Algorithm

Description

MD5-LOWER

128‑bit digest, lower‑case

MD5-UPPER

128‑bit digest, upper‑case

SHA-1

160‑bit digest

SHA-256

256‑bit digest

SHA-384

384‑bit digest

SHA-512

512‑bit digest

SHA1withRSA

SHA‑1 digest followed by RSA encryption

SHA256withRSA

SHA‑256 digest followed by RSA encryption

3.3 Encryption/Decryption Strategies

Two strategies are defined for the gateway:

SPECIFIC_JSON : encrypt the content of the encrypt field in the request body and convert it to JSON.

BODY_JSON : encrypt the content of the body field in the request body and convert it to JSON.

3.4 Interface Preset Parameters (example)

{
  "body": {
    "requestNo": "$simple_uuid$",
    "requestTime": "$millisecond_long$",
    "charset": "UTF-8",
    "signType": "SHA256withRSA",
    "encryptType": "AES"
  }
}

Place‑holder variables such as $simple_uuid$ and $millisecond_long$ are automatically replaced at runtime.

3.5 Request Item Configuration

After configuring an interface group, developers can set up individual request items, including selecting the group, enabling mock data, defining mock templates, HTTP method, content‑type, timeout, parameter mapping, and script‑based parameter processing.

4. Planning

The current gateway handles basic request processing and packaging, but further work is needed for monitoring, performance statistics, rule‑engine integration, and more flexible configuration to adapt to diverse scenarios.

5. Summary

The external gateway provides a low‑code solution for integrating multiple payment channels, reducing development effort, ensuring unified management and control, and guaranteeing secure, seamless transaction flow across channels.

backend developmentconfigurationAPI Gatewaymock-dataEncryptionPayment Integration
HomeTech
Written by

HomeTech

HomeTech tech sharing

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.