Expected Input Credential Was Not Present Error in Postman

Expected Input Credential Was Not Present Error in Postman

When integrating APIs, encountering errors is a common part of the process. One such error that can be particularly frustrating is the “Expected input credential was not present” error in Postman. This error often occurs when working with secure APIs, such as those provided by Visa. In this article, we will delve into the specifics of this error, understand its root causes, and explore step-by-step solutions to resolve it. By the end of this guide, you will have a comprehensive understanding of how to troubleshoot and fix this error.

Understanding the Error

The “Expected input credential was not present” error typically indicates that the API request is missing a required credential. This credential could be an API key, a client certificate, or another form of authentication. In your case, you’re working with Visa’s sandbox environment and trying to implement a POST request to create a card.

API Endpoint

The specific endpoint you’re working with is:

bashCopy codePOST: https://sandbox.api.visa.com/forward/cardservices/v1/programs/123123123/cards

Sample Request

Here’s the request you’re sending:

jsonCopy code{
  "formType": "PHYSICAL",
  "customization": {
    "imageId": "89282928",
    "cardStockId": "9029202",
    "collateralId": "292029202",
    "expirationDate": {
      "mm": "11",
      "yy": "23"
    }
  },
  "profile": {
    "lastName": "Miller",
    "firstName": "Alex",
    "emailAddress": "alexmiller@example.com",
    "address": {
      "primaryAddress": {
        "city": "San Francisco",
        "countryCode": "USA",
        "postalCode": "94105",
        "region": "CA",
        "line2": "Unit D1",
        "line1": "1000 Main Street"
      }
    },
    "phoneNumber": "9999999999",
    "title": "Engg",
    "suffix": "Mr"
  },
  "idempotentId": "2342420-1094092-1abcdo02-10292",
  "accountNumber": "92029201918"
}

Response

And the response you’re receiving:

jsonCopy code{
  "responseStatus": {
    "status": 400,
    "code": "9125",
    "severity": "ERROR",
    "message": "Expected input credential was not present",
    "info": ""
  }
}

Step-by-Step Solution

1. Verify API Credentials

The first step is to ensure that all required credentials are correctly configured in Postman. This typically involves:

  • API Key: Ensure that your API key is correctly included in the headers.
  • Client Certificate: Visa’s API requires mutual SSL authentication, which means you need to provide a client certificate.

How to Add a Client Certificate in Postman

  1. Open Postman.
  2. Go to Settings (the gear icon in the upper right corner).
  3. Navigate to the Certificates tab.
  4. Add a new certificate:
    • Host: sandbox.api.visa.com
    • PFX File: Browse and select your certificate file.
    • Passphrase: Enter the passphrase for the certificate if required.

2. Ensure Correct Request Headers

Your request headers must include all necessary information for authentication. Typically, this includes:

  • Authorization: This header often contains your API key or token.
  • Content-Type: Ensure this is set to application/json.

Example of setting headers in Postman:

httpCopy codeAuthorization: Bearer {your_api_key}
Content-Type: application/json

3. Check Certificate Validity

Ensure that the certificate you’re using is valid and not expired. Also, verify that the certificate matches the one associated with your API credentials on the Visa Developer Portal.

4. Test with Visa’s Hello World API

You mentioned that the Visa Developer “helloworld” API returns a 200 status response with the same certificate and private key. This is a good sign that your certificate setup is correct. However, the specific endpoint for creating a card might require additional credentials or a different setup.

5. Review Visa Developer Documentation

Double-check the Visa Developer documentation for any additional requirements or parameters that you might have missed. Pay special attention to the authentication section.

6. Contact Visa Developer Support

If you’ve followed all the steps and still encounter the error, it might be helpful to contact Visa Developer support. Provide them with the exact request and response you’re receiving. They can offer more specific guidance and check if there are any issues on their end.

Conclusion

The “Expected input credential was not present” error in Postman can be challenging to resolve, especially when working with secure APIs like those provided by Visa. By following the steps outlined in this guide, you can systematically troubleshoot and address the issue. Remember to verify your API credentials, ensure correct request headers, and check your certificate setup. If all else fails, don’t hesitate to reach out to Visa Developer support for assistance.

Understanding and resolving API errors is a crucial skill for any developer. With the knowledge gained from this guide, you’ll be better equipped to handle similar issues in the future, ensuring smooth and secure API integrations.

MasterCard Processing Digital API for Apple Pay

Scroll to Top