I was trying to add a card to a customer and the api call seemed to succeed and gave me a 200 response. But when trying to use that card to pay for an order it gave me the following response and then when I looked at the customer the card I added wasn't there.
{"message":"400 Bad Request","error":{"code":"processing_error","message":"Invalid Request. Pay request sent for stored credential transaction with invalid source."}}
My request to add the card is below
body = { source: card_token, email: email, ecomind: 'ecom' } url_string = "https://scl-sandbox.dev.clover.com/v1/customers/#{id}" url = URI(url_string) http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request["Accept"] = 'application/json' request["Contenft-Type"] = 'application/json' request["Authorization"] = "Bearer #{merchant.access_token}" request.body = body.to_json http.request(request)
Notice how I had a typo in the `Content-Type` request header. When I removed the extra 'f' everything worked as expected. I would expect the API to error if it didn't actually add the card.
Just wanted to share this.