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

Payumoney iOS SDK测试报错“key is not valid”求排查解决

Fixing PayUmoney iOS SDK Error 7025: "key is not valid"

Hey, let's break down this frustrating key is not valid error (Code 7025) you're hitting with PayUmoney's iOS checkout. I've tackled similar issues before, so here are the most common fixes to walk through:

1. Validate Your Test Credentials

First things first—double-check that you're using the correct test environment credentials:

  • Ensure your Key, Merchant ID, and Salt are pulled directly from PayUmoney's test console (not production credentials). Mixing these up is a super common culprit.
  • Watch out for accidental typos, extra spaces, or missing characters when copying these values. Even a single trailing space in your merchant key will trigger this error.

2. Verify Signature Generation (Critical!)

More often than not, this error is a red herring—it actually points to an invalid signature, not an incorrect key. PayUmoney requires a specific SHA-512 signature format for mobile checkout:

  • Use this exact formula to generate your signature:
    sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||salt)
    
  • Confirm you're using SHA-512 hashing (not SHA-256 or MD5).
  • Every parameter included in the signature must exactly match what you pass to the SDK. For example:
    • If your amount is "100.00" in the signature, don't pass "100" to the SDK.
    • Ensure txnid is a unique, alphanumeric string with no special characters.

3. Check SDK Parameter Setup

In your PaymentTestViewController, verify that you're passing credentials correctly to the SDK:

  • When initializing PaymentParam (or the equivalent object for your SDK version), confirm:
    • merchantKey is set to your test key (not empty or overwritten elsewhere)
    • merchantId matches your test merchant ID
    • The generated signature is assigned to the signature field without modifications
  • Avoid hardcoding credentials in your app long-term, but for testing, make sure they're not being altered by other parts of your code.

4. Confirm Test Environment Endpoint

If you've manually configured the SDK's API endpoint, ensure it's pointing to PayUmoney's test server:

  • The test base URL should be https://test.payumoney.com/ (some SDK versions require explicit setup of this value). Using the production endpoint with test credentials will throw this error.

5. Test with a Minimal Flow

Create a stripped-down version of your payment code with only the required parameters:

  • Use a simple txnid, fixed amount, basic productinfo, and dummy user details (firstname, email)
  • Generate the signature strictly per the formula above
  • If this minimal flow works, you'll know the issue is in a non-required parameter or edge case in your original code.

6. Update to the Latest SDK Version

Older versions of the PayUmoney iOS SDK might have bugs related to credential validation. Update to the latest version via CocoaPods or by downloading the framework directly from their developer portal.

If you still run into issues after these checks, enable debug logging in the SDK (if supported) to see the exact payload being sent to the server. This will often reveal a subtle parameter mismatch that's breaking the signature validation.

内容的提问来源于stack exchange,提问作者Abhishek Biswas

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 08:23:47