@Test public void testCancelSubscriptionAtPeriodEndPerCallAPIKey() throws StripeException { Plan plan = Plan.create(getUniquePlanParams(), Stripe.apiKey); Customer customer = createDefaultCustomerWithPlan(plan); assertEquals(customer.getSubscription().getStatus(), "active"); Map<String, Object> cancelParams = new HashMap<String, Object>(); cancelParams.put("at_period_end", true); Subscription canceledSubscription = customer.cancelSubscription(cancelParams, Stripe.apiKey); assertEquals(canceledSubscription.getStatus(), "active"); assertEquals(canceledSubscription.getCancelAtPeriodEnd(), true); }