@Test public void testTokenUsePerCallAPIKey() throws StripeException { Token createdToken = Token.create(defaultTokenParams, Stripe.apiKey); Map<String, Object> chargeWithTokenParams = new HashMap<String, Object>(); chargeWithTokenParams.put("amount", 199); chargeWithTokenParams.put("currency", "usd"); chargeWithTokenParams.put("card", createdToken.getId()); Charge.create(chargeWithTokenParams, Stripe.apiKey); Token retrievedToken = Token.retrieve(createdToken.getId(), Stripe.apiKey); assertTrue(retrievedToken.getUsed()); }
@Test public void testTokenRetrievePerCallAPIKey() throws StripeException { Token createdToken = Token.create(defaultTokenParams, Stripe.apiKey); Token retrievedToken = Token.retrieve(createdToken.getId(), Stripe.apiKey); assertEquals(createdToken.getId(), retrievedToken.getId()); }