Ejemplo n.º 1
0
 @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());
 }
Ejemplo n.º 2
0
 @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());
 }