15-api-unification

Two API generations. Three auth methods. One client.

15-api-unification

Two API generations. Three auth methods. One client.

The eupago payment gateway has two API generations live at the same time: the legacy one, where authentication is in the body and the amount field is called "valor", and v1.02, where authentication is in headers and the amount lives at "payment.amount.value".

Same gateway. Same money. Two completely different shapes.

A "thin wrapper" SDK passes that mess straight through to your code. Half the integration is then learning which call uses which generation, which auth, which field name. That's not an SDK — that's documentation with an __init__.py.

In eupago-python the application sees one thing:

client.mbway.create_payment(amount=Decimal("49.90"), order_id="ORD-001", phone_number="912345678")

Internally: the SDK picks the right generation per endpoint, picks the right auth strategy (ApiKey header for v1.02, body for legacy, OAuth for refunds), and unifies the vocabulary. Your code never says "valor". Your code never sees "ApiKey".

The interface is the product. The unification is the work.

When you wrap a messy API, are you absorbing the mess or forwarding it?

Repo: github.com/bilouro/eupago-python

P.S. New tech post every Wednesday.

#OpenSource #Python #SoftwareArchitecture

Comments