You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用Paytm initiateTransaction API遇resultCode=2006(Mid无效)问题求助

Troubleshooting Paytm InitiateTransaction API Error (ResultCode 2006: Mid is Invalid)

Here are the key fixes to resolve the "Mid is invalid" error:

1. Replace Placeholder MID with Actual Test Value

Your code uses <TEST_ENV_MID> as a placeholder. Replace this with the real test MID provided in your Paytm Business Dashboard. Failing to do this is the most common cause of this error.

2. URL-Encode MID and Order ID in Request URL

If your MID contains special characters, they need proper URL encoding to be recognized by the API. Update your URL construction code:

import java.net.URLEncoder;

// ...

String encodedMid = URLEncoder.encode(mid, "UTF-8");
String encodedOrderId = URLEncoder.encode(orderId, "UTF-8");
String postUrl = String.format("/theia/api/v1/initiateTransaction?mid=%s&orderId=%s", encodedMid, encodedOrderId);

3. Confirm API Key and MID Match

Ensure the API key you're using is associated with the test MID you provided. A mismatch between these two values will trigger the invalid MID error. Double-check both credentials in your Paytm dashboard.

4. Validate Checksum Generation

Your code generates the checksum using the same body object sent in the request, which is correct. However, ensure no unintended changes are made to the body after generating the checksum (e.g., adding/removing fields).

5. Verify Test Environment Configuration

  • You’re already using the correct test base URL (https://securegw-stage.paytm.in).
  • The websiteName is set to "WEBSTAGING", which matches Paytm’s test environment requirements.

After applying these fixes, re-run your code to test the API call again.

Content of the question is sourced from Stack Exchange, asked by Shashi Ranjan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 06:43:31