HashMap<String, Object> subscriptionData = new HashMap<>();
subscriptionData.put("customer_id", 29);
subscriptionData.put("plan_id", 101);
subscriptionData.put("line_items", Arrays.asList(
new HashMap<String, Object>() {{
put("item_name", "Monthly SaaS License");
put("item_price", 99.00);
put("quantity", 1);
}}
));
int subscriptionId = co.create(ChargeOver.Target.SUBSCRIPTION, subscriptionData);
if (subscriptionId < 0) {
System.out.println(co.getLastError());
} else {
System.out.println("Created Subscription ID: " + subscriptionId);
}