Need urgent help with 400 response INVALID_REQUEST_ERROR

      "code": "INVALID_CARD_DATA",
      "detail": "Invalid card data.",
      "field": "source_id"

Please let us know what is the reason for this and how to solve this?

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Web Payments SDK Requirements
Handling Errors
Statement Descriptions

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

@Square-Dev-AI This does not help.

The error message you’re seeing, “INVALID_CARD_DATA”, typically indicates that there’s an issue with the card information you’re trying to process. This could be due to incorrect or incomplete card details such as the card number, expiration date, CVV, or postal code.

In your case, the error is pointing to the “source_id” field. The “source_id” should be a valid payment token or card ID. If you’re using a payment token, make sure it’s generated correctly using the Web Payments SDK or In-App Payments SDK. If you’re using a card ID, ensure it’s a valid card on file.

Remember, you should not directly use card information in the CreatePayment endpoint. Instead, you should use a payment token or a card on file.

If you’ve checked these details and the issue persists, it might be a good idea to review your payment processing flow to ensure it aligns with Square’s recommended practices.

This answer was reviewed by @Bryan-Square.

We are saving the card on file to the developer account and errors are there. Can you please review our application what is wrong there?

What’s the application ID and is this for shared card on file? :slightly_smiling_face:

@Bryan-Square Application id: sq0idp-y18gddeHNN6xlcJsDTqClw, we are observing more errors like invalid card data.