#amol_08238
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- amol_08238, 1 day ago, 15 messages
- amol_08238, 3 days ago, 16 messages
- amol_08238, 4 days ago, 17 messages
- amol_08238, 6 days ago, 5 messages
hi there!
hi
yes you can use the Upcoming Invoice enpoint: https://stripe.com/docs/api/invoices/upcoming
and pass any parameters you need, like new subscription items: https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-subscription_items
ok i'll try it put thanks.
happy to help 🙂
Hi, how to pass subscription items in list without using SubscriptionItem.create. Becasue SubscriptionItem.Create will actually create these subscription items before getting invoice preview.
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
What programming language are you using?
I am using java
What does your code look like now?
public void previewInvoice(PreviewInvoiceRequest previewInvoiceRequest, StreamObserver<PreviewInvoiceResponse> responseObserver) {
SubscriptionDetail subscriptionDetail = subscriptionService.getSubscriptionsDetails(previewInvoiceRequest.getProviderOrganizationId());
if(subscriptionDetail == null) {
logger.error("Subscription not found for provider id {}", previewInvoiceRequest.getProviderOrganizationId());
Status status = Status.INTERNAL.withDescription("Failed to find subscription details for organization.");
responseObserver.onError(status.asRuntimeException());
}
List<String> productIds = previewInvoiceRequest.getProductsToAddList();
List<String> pricingIds = getPricingIdsByProductIds(productIds);
Stripe.apiKey = ''";
InvoiceUpcomingParams params =
InvoiceUpcomingParams.builder()
.setCustomer(subscriptionDetail.getProviderCustomer().getStripeCustomerId())
.setSubscription(subscriptionDetail.getStripeSubscriptionId())
.addAllSubscriptionItem()
.build();
Invoice invoice = Invoice.upcoming(params);
}
here if you see I cant find a way to create subscriotionitems
You should specify array of items as you would when creating a Subscription normally: https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-invoice_items