Skip to content

eWallet Integration Issue #90

@iromanov-xtix

Description

@iromanov-xtix

Hello! I encountered a problem when implementing eWallet payments using xendit-python==7.0.0.

My Code

import uuid
from xendit import ApiClient, Configuration
from xendit.payment_request import PaymentRequestApi

api_client = ApiClient(configuration=Configuration(
    api_key="my_key"
))

api_instance = PaymentRequestApi(api_client)

payment_request_parameters = {
    "reference_id": str("my_id"),
    "amount": 50000.0,
    "currency": "IDR",
    "metadata": {"example": "example"},
    "description": "test payment",
    "payment_method": {
        "type": "EWALLET",
        "reusability": "ONE_TIME_USE",
        "ewallet": {
            "channel_code": "SHOPEEPAY",
            "channel_properties": {
                "success_return_url": "https://o-la-la.com/success",
                "failure_return_url": "https://o-la-la.com/success",
            }
        }
    }
}

response = api_instance.create_payment_request(
    idempotency_key=uuid.uuid4().hex,
    payment_request_parameters=payment_request_parameters
)

Error Message

I got the following exception in module xendit.model_utils line 1452:

xendit.exceptions.ApiTypeError: Invalid type for variable 'url_type'. Required value type is str and passed type was NoneType at ['received_data']['actions'][1]['url_type']

API Response

When I examined the raw response, it was:

{
  "id": "pr-blabla",
  "country": "ID",
  "amount": 50000,
  "currency": "IDR",
  "business_id": "blabla",
  "reference_id": "my_id",
  "payment_method": {
    "id": "pm-bla-bla",
    "type": "EWALLET",
    "reference_id": "id-id",
    "description": null,
    "created": "2025-06-23T15:36:47.979773493Z",
    "updated": "2025-06-23T15:36:47.979773493Z",
    "card": null,
    "ewallet": {
      "channel_code": "SHOPEEPAY",
      "channel_properties": {
        "success_return_url": "https://o-la-la.com/success",
        "failure_return_url": "https://o-la-la.com/success"
      },
      "account": {
        "name": null,
        "account_details": null,
        "balance": null,
        "point_balance": null
      }
    },
    "direct_debit": null,
    "direct_bank_transfer": null,
    "over_the_counter": null,
    "virtual_account": null,
    "qr_code": null,
    "metadata": null,
    "billing_information": {
      "country": "",
      "street_line1": null,
      "street_line2": null,
      "city": null,
      "province_state": null,
      "postal_code": null
    },
    "reusability": "ONE_TIME_USE",
    "status": "ACTIVE"
  },
  "description": "test payment",
  "metadata": {"example": "example"},
  "customer_id": null,
  "capture_method": "AUTOMATIC",
  "initiator": null,
  "card_verification_results": null,
  "created": "2025-06-23T15:36:48.079949926Z",
  "updated": "2025-06-23T15:36:48.079949926Z",
  "status": "REQUIRES_ACTION",
  "actions": [{
    "action": "AUTH",
    "url": "https://ewallet-mock-connector.xendit.co/v1/ewallet_connector/checkouts?token=bla-bla",
    "url_type": "DEEPLINK",
    "method": "GET",
    "qr_code": null
  }, {
    "action": "PRESENT_TO_CUSTOMER",
    "url": null,
    "url_type": null,
    "method": null,
    "qr_code": "test-qr-string"
  }],
  "failure_code": null,
  "channel_properties": null,
  "shipping_information": null,
  "items": null
}

Root Cause

The issue appears to be in the xendit.payment_request.model.payment_request_action.PaymentRequestAction class. According to the openapi_types function, url_type is defined without allowing null values, but the API response contains null for this field in the second action item.

class PaymentRequestAction(blabla):
    ...

    @cached_property
    def openapi_types():
        """
        This must be a method because a model may have properties that are
        of type self, this must run after the class is loaded

        Returns
            openapi_types (dict): The key is attribute name
                and the value is attribute type.
        """
        return {
            'action': (str,),  # noqa: E501
            'url_type': (str,),  # noqa: E501
            'method': (str, none_type,),  # noqa: E501
            'url': (str, none_type,),  # noqa: E501
            'qr_code': (str, none_type,),  # noqa: E501
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions