#Manu-Java-Sub

1 messages · Page 1 of 1 (latest)

runic swan
#

Hi there! Give me a moment to take a look

#

Have you tried breaking this up?

#

Like are you able to retrieve just the invoice?

hollow drum
#

The subscription returned by stripe comes up without a latest invoice

runic swan
#

What Java version and Stripe API version are you using?

#

Can you provide me the Subscription ID for the above?

hollow drum
#

sub_1Kkx8HCHmpRPH3HpRnPLSK08

#

Java 1.8 / Stripe 20.35.0

runic swan
#

Thanks, looking!

#

Ah okay

#

Interesting

#

Sorry, still verifying.

#

You are using licensed usage

#

And there is no initial invoice

#

I believe this is expected

#

But I haven't played with licensed usage in quite a while

#

So looking to verify

hollow drum
#

Thank you! We took a look at the documentation, which sets the subscriptions payment behaviour as DEFAULT_INCOMPLETE.

#

But we only have ALLOW_INCOMPLETE, ERROR_IF_INCOMPLETE and PENDING_IF_INCOMPLETE available.

runic swan
#

Yes but with licensed usage there will be no initial charge, as the amount is determined during the billing cycle.

#

So the Subscription will always become active immediately.

hollow drum
runic swan
#

What is your model? Are you sure you want to be using a licensed type of pricing?

#

Do you want to charge the customer immediately when they activate the Subscription?

hollow drum
#

We sell software licenses, a per-seat subscription model.

runic swan
#

And do you know that per-seat amount upon the start of the Sub?

#

You may want to take a peak at that if you haven't seen it.

hollow drum
runic swan
#

Okay so you do know how many seats your customer wants up front.

#

In that case you don't want to use licensed usage.

#

You would just use a "Standard pricing" model here where you then charge a quantity equal to the amount of seats you want to provide.

#

This will then generate an initial invoice when you create the Subscription

#

And default_incomplete will come into play here

hollow drum
#

So we would be replacing this part

#

with

#

this?

runic swan
#

All you need to really change is the price ID that you are using

#

So create a new product/price via either the Dashboard or the API

#

That uses "Standard pricing"

hollow drum
#

which is the price we are passing to stripe at the moment

runic swan
#

Okay I looked again and I missed that you were setting billing_cycle_anchor to the future

#

My bad!

hollow drum
#

The business logic dictates that the billing_cycle be at the 5th of every month

runic swan
#

That is why no invoice is created.

#

So there are a couple ways to work around this.

#

You don't want to charge the customer for the amount of time from when the Sub is created until the 5th of the month, correct?

#

That would be the easiest way... but can lead to some small prorated invoices

hollow drum
#

I need to charge the difference up to the next months fifth. If a customer buys a subscription on the 20th I need to be able to charge the difference between the 20th and the 5th of next month, and then charge him the price for the entire billing cycle from 5th to 5th the following month.

runic swan
#

Oh that is easy then... just remove your proration_behavior parameter!

#

As the default will be to create prorations here, which will generate an invoice for the prorated amount until the 5th of next month

hollow drum
#

Will that invoice be generated at the same time as the subscription? Or on the 5th of next month?

runic swan
#

At the time of creation

hollow drum
#

Well now that just might solve everything.

#

Let me try and get back to you ASAP, thank you so much!

keen viper
#

Reopened!

hollow drum
#

After removing the proration behavior I get the following error:
com.stripe.exception.InvalidRequestException: This customer has no attached payment source or default payment method.; code: resource_missing; request-id: req_BN7aDCLUPRbxnQ

#

Thanks!

#

Don't I need the clientSecret to pass to my payment-element on the FE and save the default payment method after the first payment has been made?

rocky moon
#

Sorry, default_incomplete instead.

hollow drum
rocky moon
#

Let me test this out on my end real quick. In the meantine, can you share the request id for this error?

hollow drum
rocky moon
#

Thank you, please give me some time

hollow drum
#

Absolutely, appreciate it!

rocky moon
#

I was able to test this on my test account and payment_behavior: "default_incomplete" seems to be working as expected without returning 'This customer has no attached payment source or default payment method.'.

It also appears that you're using Javalibrary 20.35.0 and the default_incomplete behavior was not introduced until 20.48.0.

https://github.com/stripe/stripe-java/blob/master/CHANGELOG.md#20480---2021-05-05

The recommendation here is to upgrade this on your end.

hollow drum
#

I will upgrade the library right away. Thank you.

hollow drum
#

Upgrading the library did the job. Thank you very much for your time. I'm receiving the client_secret i was looking for. and now I'm going to work on the payment-element in the FE. Thanks again!