create subscription using using customer id in stripe code example

Example: stripe customer subscription creation

Stripe.apiKey = "sk_test_51GxVwbJ4s7XuDwiBI9WcRYmSuSJihNlMtIaZNZv5G2UvFAdGbj5VHvhwhSODsF4xsd1jYOPqWlORLUMpXkiX4Hhf00PgGFcKqp";

List<Object> items = new ArrayList<>();
Map<String, Object> item1 = new HashMap<>();
item1.put(
  "price",
  "price_1GyXO4J4s7XuDwiBgZuarsP8"
);
items.add(item1);
Map<String, Object> params = new HashMap<>();
params.put("customer", "cus_HXPA4Dd7nRTM5W");
params.put("items", items);

Subscription subscription =
  Subscription.create(params);

Tags:

Php Example