#Dynelight
1 messages ยท Page 1 of 1 (latest)
Yes, you can create different portal configurations (https://stripe.com/docs/api/customer_portal/configuration?lang=cli#portal_configuration_object) and use the appropriate one when creating a portal session (https://stripe.com/docs/api/customer_portal/sessions/create?lang=cli#create_portal_session)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
This is what I need, but I'm having a hard time understanding how to build this hash on Ruby
Stripe::BillingPortal::Configuration.create({
features: {
subscription_update: {
products: [{
product: <Product here>,
prices: [price1, price...],
}]
}
invoice_history: {enabled: true},
},
})
Would it be something like this?
Yes, it looks OK to me.
Run it with actual product/price ID, and we can continue the discussion here if you encounter any errors
[9] pry(#<BillingController>)> Stripe::BillingPortal::Configuration.create({
business_profile: {nabled: true},
headline: "Test Headline",
privacy_policy_url: "https://domain.co/privacy",
terms_of_service_url: "https://domain.co/terms"
},
features: {
subscription_update: {
default_allowed_updates: {
price: true,
quantity: false,
promotion_code: true,
},
enabled: true,
products: [
{
product: 'prod_Mrs2Z8n4Q28uzn',
prices: ['price_0M88IE85cJoRoAtCZCMx6FMq'],
}
]
},
invoice_history: {enabled: true},
},
})
Stripe::InvalidRequestError: Invalid array
I'm getting Stripe::InvalidRequestError: Invalid array
Does it tell you which line?
No
default_allowed_updates: ['price', 'quantity', 'promotion_code'],
The default_allowed_updates expects an array, not hash
business_profile: {
headline: "Test Headline",
privacy_policy_url: "https://domain.co/privacy",
terms_of_service_url: "https://domain.co/terms"
},
features: {
subscription_update: {
default_allowed_updates: ['price', 'quantity'],
enabled: true,
products: [
{
product: 'prod_Mrs2Z8n4Q28uzn',
prices: ['price_0M88IE85cJoRoAtCZCMx6FMq'],
},
],
},
invoice_history: {enabled: true},
},
})
Stripe::InvalidRequestError: Cannot enable subscription updates while disabling payment method update.
Stripe::InvalidRequestError: Cannot enable subscription updates while disabling payment method update.
getting there lol
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes please enable payment_method_update
you pass that portal configuration id when creating the billing portal : https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-configuration
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
It's starting to shape up.
I'm having the issue that I have 2 different subscription products. They're all tied to the same user.
The billing portal is showing me everything that I am subscribed for, including the two types of products. When I try to update the plan, it does limit it to the one that I need, so that's good.
is there a way to also filter the subscriptions present?
or at the very least, just enable updates to the type of subscription I am filtering?
you can configure what specific Products you want to allow updates for : https://stripe.com/docs/api/customer_portal/configurations/create#create_portal_configuration-features-subscription_update-products
It seems to be letting me update subscriptions I did not specify
It's allowing me to update them to the subscriptions I specified
I don't want to enable the updates from them though. Just show them
can you share the request id for the billing portal? and the subscription id that you don't want to allow updates to
The ID of the configuration?
cbpc_0MR8BF85cJoRoAtCQ8ZHj2rh
I'm just allowing subscription updates to prod_Mrs2Z8n4Q28uzn
what's the request id to create the portal? https://stripe.com/docs/api/customer_portal/sessions/create
I use the pay gem to create the billing portals
configuration: 'bpc_0MR8BF85cJoRoAtCQ8ZHj2rh',
return_url: "#{root_url}dashboard"
)
redirect_to @entity.url```
umm, sorry, i meant, you created a portal session for the customer to access right?
do you have the request id for that
not looking for the code
Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
bps_0MR8XY85cJoRoAtCJSzwNMJJ
Or can you share with me your merchant ID? you can find it from the Stripe Dashboard -> Settings ->Account Details
Let me take a look
I don't want to enable the updates from them though. Just show them -> What do you mean by this ?
I have 2 subscription types on my logic, funds and groups
I want to have a billing portal for funds and a billing portal for groups
I want to be able to configure groups, so I want to see the funds and the groups but I only want to update the groups. Right now I can change the fund to anything I want
I still don't quite understand what you want
I want the billing portal to not show certain types of subscriptions or not let me update them
Lets say I have subscriptions A, B, C and D.
I want my configuration to allow me to see only subscriptions A and B
But I see subscriptions C, I want to either not show me subscriptions C, or not let me update them to subscriptions A
Is this better
is the customer already subscribed to price C?
Yes
Yes he is
So I dont mind showing it but Indont want to update it on this configuration
I only want to update A and B
So your customer has already subscribed to A B and C. You just want them to change from A -> B, B->A, C->A and C->B, but not A->C or B->C, am I right?
I want them to be able to change their subscription A to B or B to A
But leave C intact
Then in this case you need to build two configs, and use them conditionally
- allows A and B
- allow none of them.
And I want to do a configuration to do the opposite, have C be able to update to a plan D ans vice versa, leave all As and Bs as it is
I made in theory a config just to allow one plan and I can update all my subscriptions to this plan only.
But I can't conditionally allow updates
What I mean is that you can conditionally use different config before creating a customer portal session
So I made a config to only allow to update to specific plans and that works but I see my other plan types and I either dont want to see them or dont allow to update them
Lemme try rephrasing. If I have subscription types A, B and C, and my user is subscribed to all of them, can I configure the stripe billing portal to only show A and B?
Sorry if this is too tricky
No, your customer will see C because he/she has already subscribed to it
Ok
Is it possible to conditionally allow updating plans?
Like only allow to update if its A or B but not C
Because right now what its letting me do is update to the plans I specified
In other words, can some subscriptions be updated and some dont for the sale billing portal?
I still don't understand you. Your customer has already subscribed to C, so what's point of hiding C ?
I dont want it to update to B or A because its a different type of subscription
A and B are for pears and C is for apples, for example lol
So I want tk be able to update B into A and vice vesa but not C
So A and B are two prices that belong to the same product, and C is a price for another product, am I right?
Its two different products
OK. This use case is not supported at this moment, you can only define what product/price that your customer can update to, but there's no way to restrict what product/price that your customer to update from.