#viking66

1 messages · Page 1 of 1 (latest)

hushed bridgeBOT
drifting sentinel
snow socket
#

req_cUz6u6ceIaAtVw

drifting sentinel
#

Oh, you're trying to create a Portal Session on a connected account, not your platform account.

#

That's probably why you're getting that error.

snow socket
#

is that not possible?

#

this is what i'm doing

func (self Stripe) CreatePortalSession(accountID string, customerID string, returnURL string) (*string, error) {
        stripe.Key = self.key

        params := &stripe.BillingPortalSessionParams{
                Customer:  stripe.String(customerID),
                ReturnURL: stripe.String(returnURL),
                FlowData: &stripe.BillingPortalSessionFlowDataParams{
                        Type: stripe.String("payment_method_update"),
                },
        }
        params.SetStripeAccount(accountID)

        portalSession, err := portal.New(params)
        if err != nil {
                return nil, err
        }

        if portalSession == nil {
                return nil, fmt.Errorf("Failed to create billing portal session")
        }

        return &portalSession.URL, nil
}
drifting sentinel
#

You need to navigate to that connected account in your Dashboard, click on the ••• button in the top right, view the Dashboard as that account, then navigate to those settings and save them there.

#

The URL would be something like https://dashboard.stripe.com/acct_123/test/settings/billing/portal

#

To clarify, though, you probably don't want to go and manually set this up every time via the Dashboard for every connected account, right?

#

Then specify it when you create the Portal Session.