#hugo-l_api

1 messages Β· Page 1 of 1 (latest)

primal trenchBOT
#

πŸ‘‹ Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

πŸ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1351231812910977085

πŸ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

scarlet wing
#

Hello πŸ‘‹

I see from the request you shared, the configuration includes two products each with 2 prices. How is this not behaving as you would expect?

mossy ore
#

I have about ten types of configurations that look like this:

{
    "id": "...
",
    "object": "billing_portal.configuration",
    "active": true,
    "application": null,
    "business_profile": {
        "headline": null,
        "privacy_policy_url": "https://www.....",
        "terms_of_service_url": "https://www..."
    },
    "created": 1666703779,
    "default_return_url": null,
    "features": {
        "customer_update": {
            "allowed_updates": [],
            "enabled": false
        },
        "invoice_history": {
            "enabled": false
        },
        "payment_method_update": {
            "enabled": true
        },
        "subscription_cancel": {
            "cancellation_reason": {
                "enabled": false,
                "options": [
                    "too_expensive",
                    "missing_features",
                    "switched_service",
                    "unused",
                    "other"
                ]
            },
            "enabled": false,
            "mode": "at_period_end",
            "proration_behavior": "none"
        },
        "subscription_pause": {
            "enabled": false
        },
        "subscription_update": {
            "default_allowed_updates": [
                "price"
            ],
            "enabled": true,
            "proration_behavior": "always_invoice",
            "schedule_at_period_end": {
                "conditions": []
            }
        }
    },
    "is_default": false,
    "livemode": false,
    "login_page": {
        "enabled": false,
        "url": null
    },
    "metadata": {},
    "updated": 1671627457
}

I need to add one more! But I don’t understand how to link my products to this configuration or a new one

scarlet wing
#

Products and prices can only be linked in the subscription_update paramerter we document here

mossy ore
#

Ok thx ! So how this configuration can work bpc_1Lwn9xGqdJoAtm42lrcFxq9p ? Because it do not specify any type of product but it's well linked to one πŸ˜…

scarlet wing
#

I don't know what you mean by this. Specifying products in your configuration allows you to offer different prices on the same product to customers who are already subscribed to a price for that product.

mossy ore
#

Okay, the configuration provided above is retrieved from the API route: https://api.stripe.com/v1/billing_portal/configurations/{ID_CONFIG}.
It doesn't specify any linked products under feature.subscription_update.products/prices.
However, in my customer portal, I can see the plan I want to offer, along with the user's current plan.

My underlying question: Does the endpoint used return the entire configuration in its entirety? If so, I don't understand how my configuration can work.

scarlet wing
#

I don't know what you mean by that. Billing Portal configurations are IDs you pass when creating a portal session.

mossy ore
#

https://docs.stripe.com/api/customer_portal/configurations/retrieve

I use this API route to understand how my different customer portal configurations are set up and to replicate them.

In the configurations I use, I don't see any products linked, like in the configuration sent above.

Does the endpoint you provide give access to the entire configuration, including feature.subscription_update.products/prices, or just a part of it?

scarlet wing
#

I am looking at bpc_1Lwn9xGqdJoAtm42lrcFxq9p right now. I see a single Product with a single Price defined for it.

mossy ore
#

Yes for example i get this config form the retrieve endpoint :

{
    "id": "bpc_1Lwn9xGqdJoAtm42lrcFxq9p",
    "object": "billing_portal.configuration",
    "active": true,
    "application": null,
    "business_profile": {
        "headline": null,
        "privacy_policy_url": "https://www...",
        "terms_of_service_url": "https://www...."
    },
    "created": 1666704433,
    "default_return_url": null,
    "features": {
        "customer_update": {
            "allowed_updates": [],
            "enabled": false
        },
        "invoice_history": {
            "enabled": false
        },
        "payment_method_update": {
            "enabled": true
        },
        "subscription_cancel": {
            "cancellation_reason": {
                "enabled": false,
                "options": [
                    "too_expensive",
                    "missing_features",
                    "switched_service",
                    "unused",
                    "other"
                ]
            },
            "enabled": false,
            "mode": "at_period_end",
            "proration_behavior": "none"
        },
        "subscription_pause": {
            "enabled": false
        },
        "subscription_update": {
            "default_allowed_updates": [
                "price"
            ],
            "enabled": true,
            "proration_behavior": "always_invoice",
            "schedule_at_period_end": {
                "conditions": []
            }
        }
    },
    "is_default": false,
    "livemode": false,
    "login_page": {
        "enabled": false,
        "url": null
    },
    "metadata": {},
    "updated": 1669822478
}
scarlet wing
#

Okay so the issue is that the features.subscription_update.products is an Expandable property. You can see in our API reference it has the Expandable label.

#

This means we don't include it by default

#

You need to pass expand=['features.subscription_update.products'] to get the list returned to you

#

We discuss how to expand properties here