stripe subscription with paymentintent code example
Example 1: 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);
Example 2: stripe payment refund
{
"id": "re_1I65p52eZvKYlo2CrOr8b3iF",
"object": "refund",
"amount": 100,
"balance_transaction": null,
"charge": "ch_1I65p42eZvKYlo2Ch6Z0IPRW",
"created": 1609815783,
"currency": "usd",
"metadata": {},
"payment_intent": null,
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": null
}