#akii-list-subscriptions
1 messages ยท Page 1 of 1 (latest)
Thanks, taking a closer look.
That looks like a request for creating a subscription rather than one to retrieve subscriptions.
That looks like a request to update a customer object. Do you have the ID of the customer that you're trying to retrieve the subscriptions for?
Alright, I am seeing one subscription for that customer, so I'd expect the list results to not be null. Have you tried retrieving the current list of subscriptions for this customer by using their ID as a filter for this method?
https://stripe.com/docs/api/subscriptions/list?lang=java#list_subscriptions-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
okay this is a different way to do this, i try this one
Will you wait and not close this thread???
It worked !! I did this
Also, im doing this
Map<String, Object> params = new HashMap<>();
params.put("customer", customerId);
SubscriptionCollection subscriptions =
Subscription.list(params);
Is there any params class i can send instead of making a Map??
Java
I believe there is another way to set these params in Java, checking in to that...
SubscriptionCreateParams is exactly what you would use. I found some example code with them here https://github.com/stripe-samples/subscription-use-cases/blob/d17948a4/fixed-price-subscriptions/server/java/src/main/java/com/stripe/sample/Server.java#L201
.builder()
.setCustomer(customerId)
.addItem(
SubscriptionCreateParams
.Item.builder()
.setPrice(priceId)
.build()
)
.setPaymentBehavior(SubscriptionCreateParams.PaymentBehavior.DEFAULT_INCOMPLETE)
.addAllExpand(Arrays.asList("latest_invoice.payment_intent"))
.build();```