June 27, 2022
cancel
Showing results for 
Search instead for 
Did you mean: 
Help

Create Card APIs are failing

Arvind
New Contributor III

Hi All,

I was trying out Create Card APIs and it is failing for me. PFA the error response that we are getting.

 

{
    "error_message": "query did not return a unique result: 2"
}
  • I have tried with multiple sandboxes and Card products.
  • If there is a maintenance is going please inform us the ETA.
  • Last time we checked this API is : Fri, 27 Aug 2021 06:08:40 GMT

 

Thanks and Regards,
Arvind

11 REPLIES 11

Ricardo
Community Manager
Community Manager

Hey @Arvind - thanks for letting us know. Mind sharing the full API request? That way we can troubleshoot things quicker on our end. 

Arvind
New Contributor III

Hi @Ricardo ,

I tried with the recent payload that Marqeta Docs have.
Our System's APIs also started failing too, which were working fine earlier.

Arvind
New Contributor III

Request

{
    "token": "jit_funding_card",
    "user_token": "183c92ec-3de1-41e9-9235-58c3bdbc3cf5",
    "fulfillment": {
        "card_personalization": {
            "text": {
                "name_line_1": {
                    "value": "Jane Doe"
                },
                "name_line_2": {
                    "value": "My card personalization line 2"
                }
            },
            "images": {
                "card": {
                    "name": "my_card_logo.png",
                    "thermal_color": "Black"
                },
                "signature": {
                    "name": "my_signature.png"
                },
                "carrier_return_window": {
                    "name": "my_return_address_image.png"
                }
            }
        }
    },
    "card_product_token": "jit_funding_card_product",
    "metadata": {
        "key1": "value1",
        "key2": "value2"
    }
}



Response

{
    "error_message": "query did not return a unique result: 2"
}

alvinlee
New Contributor II

@Arvind Just taking a stab at it here...

It looks like you are providing a token `jit_funding_card` for the card you are attempting to create. The card token is a unique identifier for the card (see documentation), which means this request will only work one time. After that, a card with the `jit_funding_card` token will already exist. Is it possible that you've already had a successful creation of a card with this token? You can try to list cards for user to see if a card with this token already exists for this user.

An alternative (and possibly preferable) approach is *not* to provide a token when you make the create card request. This way, the system will generate one for you automatically, ensuring that it is unique and you don't have token collisions.

Arvind
New Contributor III

Hi @alvinlee ,
Thanks for the suggestion.
Yes, we have tried all the permutations for that, but was not able to get through.
Now, I guess it's working for us

Ricardo
Community Manager
Community Manager

Thanks for sharing 

Ricardo
Community Manager
Community Manager

@Arvind - the card team has resolved the issue. Can you confirm?

Arvind
New Contributor III

Hi @Ricardo ,

Yeah, we are now able to create new cards. Thanks for the Update.
Can you please let us now, what was the issue ?

Ricardo
Community Manager
Community Manager

@Arvind - Great to hear it's been resolved. The team is actively investigating and could use your help. Would you be able to share your log of what was run after you received the error? Were you making any additional API calls? 

Arvind
New Contributor III

Hi @Ricardo 

I got this error first in one of the sandbox that we are using in our project and after a little debugging, we got to know its an error from marqeta. To cross-check that, when we tried it in our personal sandboxes, it has returned with same error.
So, effectively nothing as such we did before and after this Create Card APIs. And we tried this manually too, so I don't think it was making additional API calls.

Ricardo
Community Manager
Community Manager

Thanks for sharing @Arvind, that was helpful. The team believes it is a configuration issue with the crypto key table though can’t be certain without the logs. We’ll be monitoring but happy it has been resolved, please let us know if you have any issues.