I am using the Cards SDK, and I have wrapped the results in my own PHP, including a wrapper around the SDK interface.
I discoved user problems in the real world, and began some intensive testing.
The problem involves a ‘source used before’ API error result.
My testing method involved
- Creating TEST customers
- Using the SDK inside my wrapper to do a pretty “Enter your card here” for customers with no saved card, then
- For customers, Using the SDK inside my wrapper with a pretty “Update your card info here”
- The wrapper checks the save card results and shows “card saved successfully” or “Could not save, please recheck your info” after the card has an error.
- I used my 7 personal cards to test.
Here’s my situation.
My code always successfully saves a card on the first try with a new customer. Correctly shows “saved”, or “recheck info” if I deliberately alter the CVV, etc. When I make corrections, the card is saved as it should be.
If I try to change the customer’s saved card with another of my cards, however, I now always get the following result:
[category] => 'INVALID_REQUEST_ERROR'
[code] => 'SOURCE_USED'
[detail] => 'Source was used before.'
[field] => 'source_id'
This generates the “Could not save, please recheck your info” in the wrapper.
I have checked the nonces, and they are different even if the same card is being submitted.
YOU SHOULD BE AWARE that i have used all of my cards numerous times in these tests. The “source was used before”-- but not with new customers.
But I don’t get this error on the initial save with a new customer, only on the update.
Any ideas?
Thanks for the help.