Debug Signature and Connectivity Issues
Integration with the Get Smart API Cloud is generally straightforward, but strict security and network requirements can sometimes cause requests to fail. This guide addresses the two most common categories of errors: Signature Validation Failures and Connectivity/Timeout issues.
Scenario 1: “Firma Incorrecta” (TPC0101)
The error code TPC0101 (“Incorrect Signature”) is the most frequent issue developers encounter. It means the hash you calculated on your server does not match the hash calculated by the API Cloud.
The Diagnostic Checklist
If you receive this error, check these five common pitfalls:
1. JSON Minimization
The Issue: You are hashing a “pretty-printed” JSON string (with spaces and newlines), but sending a minified version (or vice versa).
The Fix: The string you hash must be identical to the string in the info field.
- Wrong: Hashing
{"importe": "10"}but sending{"importe": "10" }(note the extra space). - Best Practice: Serialize your object to a string first, hash that string, and then put that exact string into your request body.
2. Field Ordering
The Issue: JSON is unordered by default. Your JSON library might reorder fields (e.g., putting terminal before comercio) when serializing.
The Fix: While the API parses JSON flexibly, the signature verification is a byte-for-byte comparison. Ensure the string you hash has the fields in the exact same order as the string you send over the network.
3. Environment Key Mismatch
The Issue: You are sending a request to the Test URL but signing it with your Production Key (or vice versa).
The Fix: Verify your configuration variables.
- Test URL:
https://tpvpc-i.redsys.es...requires the Test Secret (oftenAAABBBin docs, but unique to you). - Production URL:
https://tpvpc.redsys.es...requires your live Secret.
4. Character Encoding
The Issue: Your Invoice ID (factura) contains special characters (e.g., “Café-001”) and is being hashed as ASCII instead of UTF-8.
The Fix: Ensure your hashing function inputs are explicitly encoded as UTF-8.
5. Escaped Characters
The Issue: Your JSON serializer escapes forward slashes (e.g., https:\/\/).
The Fix: If your serializer adds escapes to the urlNotificacion, those escapes are part of the string and must be included in the hash calculation.
Scenario 2: Connectivity Timeouts
If your application hangs or receives connection errors before getting a JSON response, check your network configuration.
1. Firewall and Ports
The Test Environment runs on a non-standard port.
- Test Port:
27443 - Production Port:
443(Standard HTTPS) - Action: Ensure your outbound firewall allows traffic to
tpvpc-i.redsys.eson port27443.
2. TLS Version
The API requires TLS 1.2 or higher.
- Symptom: “Handshake Failure” or “Connection Reset”.
- Action: If you are using an older server (e.g., old Java 7, .NET 4.5), you may need to explicitly enable TLS 1.2 in your HTTP client configuration.
Scenario 3: “Bad Request” or Generic Errors
If the API returns a standard HTTP error (400, 415, 500) without a specific JSON error code:
| HTTP Code | Likely Cause | Solution |
|---|---|---|
| 415 Unsupported Media Type | Missing Headers | Ensure you send Content-Type: application/json. |
| 400 Bad Request | JSON Syntax | You might be sending null values (forbidden) or malformed JSON. |
| 500 Internal Server Error | Invalid Data Types | Check if you are sending a String where a Number is expected (or vice versa). |
Common Logic Error Codes
Once connectivity and signatures are working, you might face logic errors from the terminal.
| Code | Message | Meaning |
|---|---|---|
| TPVPC0016 | El comercio no posee ningún terminal TPVPC válido | The terminal number sent (e.g., 1) is not linked to your comercio account in the cloud settings. |
| TPVPC0030 | El sistema está ocupado. Reinténtelo de nuevo en unos instantes | The terminal is busy processing another request. Wait and retry. |
| TPVPC0060 | No existe ningún terminal apropiado para tratar la marca de tarjeta introducida | You requested a card brand (e.g., AMEX) that your terminal is not configured to accept. |
Next Steps
- General API Standards and Headers: Review the strict JSON formatting rules.
- Error and Denial Code Catalog: A full list of TPVPC error codes for deeper debugging.