I'm getting this error when I click on the URL of the created session:
"Something went wrong You might be having a network connection problem, or the payment provider cannot be reached at the moment."
Code:
Map<String, Object> paramsPriceIdList1 = new HashMap<>();
paramsPriceIdList.put2("price", price_id1);
paramsPriceIdList.put2("quantity", 2);
Map<String, Object> paramsPriceIdList2 = new HashMap<>();
paramsPriceIdList.put2("price", price_id2);
paramsPriceIdList.put2("quantity", 2);
List<Object> lineItems = new ArrayList<>();
lineItems.add(paramsPriceIdList1);
lineItems.add(paramsPriceIdList2);
Map<String, Object> params = new HashMap<>();
params.put(
"success_url",
"https://example.com/success"
);
params.put(
"cancel_url",
"https://example.com/cancel"
);
params.put("line_items", lineItems);
params.put("mode", "subscription");
Session session = Session.create(params);
System.out.println(session);
If I try to use only 1 item, it works.