I am trying to test Stripe payment API in my android app. The Android app sends a token (token is provided by Stripe to the Android app) to the server, and then the server uses the token charge the user via the Stripe charge API. Since I am testing the process, I am using the dummy values provided by Stripe, but when I initiate a charge call I get an InvalidRequestException
on the server side. I am having hard time testing it.
For clarity's sake, I am also adding an image.
Here is my code.
try {
Map<String, Object> chargeParams = new HashMap<String, Object>();
chargeParams.put("amount", jsonNode.get("amount")); // amount in cents, again
chargeParams.put("currency", "USD");
chargeParams.put("source", token);
chargeParams.put("description", "charge from server");
Charge charge = Charge.create(chargeParams);
String des = charge.getDescription();
}
catch (CardException e) {
// The card has been declined
}
How can I test this process? Please guide me into the right direction.