#Dynelight

1 messages ยท Page 1 of 1 (latest)

wet lilyBOT
robust thorn
#
sour compass
#

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?

robust thorn
#

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

sour compass
#

[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

robust thorn
#

Does it tell you which line?

sour compass
#

No

robust thorn
#

default_allowed_updates: ['price', 'quantity', 'promotion_code'],

#

The default_allowed_updates expects an array, not hash

sour compass
#

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

robust thorn
#

Yes please enable payment_method_update

sour compass
#

Got it I think!

#

Now I need to pass that ID to the billing portal, right?

south cove
sour compass
#

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?

south cove
sour compass
#

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

south cove
#

can you share the request id for the billing portal? and the subscription id that you don't want to allow updates to

sour compass
#

The ID of the configuration?

#

cbpc_0MR8BF85cJoRoAtCQ8ZHj2rh

#

I'm just allowing subscription updates to prod_Mrs2Z8n4Q28uzn

south cove
sour compass
#

I use the pay gem to create the billing portals

#
      configuration: 'bpc_0MR8BF85cJoRoAtCQ8ZHj2rh',
      return_url: "#{root_url}dashboard"
    )
    redirect_to @entity.url```
south cove
#

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

robust thorn
sour compass
#

bps_0MR8XY85cJoRoAtCJSzwNMJJ

robust thorn
#

Or can you share with me your merchant ID? you can find it from the Stripe Dashboard -> Settings ->Account Details

sour compass
#

acct_2JsG85cJoRoAtCN7h5pv

#

did I find a bug on the portal? lol

robust thorn
#

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 ?

sour compass
#

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

robust thorn
#

I still don't quite understand what you want

sour compass
#

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

robust thorn
#

is the customer already subscribed to price C?

sour compass
#

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

robust thorn
#

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?

sour compass
#

I want them to be able to change their subscription A to B or B to A

#

But leave C intact

robust thorn
#

Then in this case you need to build two configs, and use them conditionally

  1. allows A and B
  2. allow none of them.
sour compass
#

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

robust thorn
#

What I mean is that you can conditionally use different config before creating a customer portal session

sour compass
#

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

robust thorn
#

No, your customer will see C because he/she has already subscribed to it

sour compass
#

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?

robust thorn
#

I still don't understand you. Your customer has already subscribed to C, so what's point of hiding C ?

sour compass
#

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

robust thorn
#

So A and B are two prices that belong to the same product, and C is a price for another product, am I right?

sour compass
#

Its two different products

robust thorn
#

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.

sour compass
#

Thats a shame

#

Thanks for your time ๐Ÿ™‚