#joshglazebrook
1 messages ยท Page 1 of 1 (latest)
The subscription should be set to active when the first invoice is $0. paid status is only for the invoices.
Shouldn't the subscription be active?
Essentially i'm trying to follow this - https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=subscription#web-collect-payment-details
So the user registers, is presented with lets say 3 plans, chooses one, enters their payment info (paymentelement), then confirms/submits.
One of which is $0.00/month + $0.05/per unit used.
I create the subscription object for the customer, I'm setting paymentbehavior as "default_incomplete", as I want to collect the payment info after the user selects the subscription plan. But the subscription is automatically in the "active" state because the invoice is $0.00, even though I haven't collected their payment method.
subscriptionParams := &stripe.SubscriptionParams{
Customer: teamEnt.StripeCustomerID,
Items: []*stripe.SubscriptionItemsParams{
{
Price: stripe.String(reqParams.PriceID),
},
},
PaymentSettings: &stripe.SubscriptionPaymentSettingsParams{
SaveDefaultPaymentMethod: stripe.String("on_subscription"),
},
PaymentBehavior: stripe.String("default_incomplete"),
}
subscriptionParams.AddExpand("latest_invoice.payment_intent")
Then collect payment info via paymentelement, etc.
Only this price is $0.00, others are $49.99/month as an example and they start in the "incomplete" state.
So in this case, I would immediately get the customer.subscription.created as technically its immediately paid for, but I haven't collected any payment methods from the customers for future one off charges or future invoices that will not be $0.00 nor completed a final "subscribe" action from the user which seems kinda weird.
๐ catching up and gimme some time
$0.00/month + $0.05/per unit used.
How do you setup this Price?
Do you set it as metered usage or licensed usage?
So the way I was going about it was just having a standard priced product for the monthly fee. $0.00/month in this case. And then I have another product for the "unit" which I was just going to add as an invoice item for the upcoming invoice.
I think its similar to "flat rate + metered", but the flat rate in this case is $0.00/month. and the metered product is $0.05.
But because the flat rate is $0.00 in this case, creating that subscription automatically sets it to active?
I see, so it will trigger the Subscription to be active when it see the first Invoice is $0. That's how Billing engine works. I would recommend taking a look at Usage-based Pricing model https://stripe.com/docs/products-prices/pricing-models#usage-based-pricing and model your Pricing into a metered type Price object
So I want to have a flat rate + usage. But the lowest tier is a free flat rate + usage.
The user can change to a non free flat rate + usage plan. etc
Yeah, on each tier you can have the flat amount https://stripe.com/docs/api/prices/create?lang=java#create_price-tiers-flat_amount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.