#viking66
1 messages · Page 1 of 1 (latest)
Hello! Can you give me the request ID showing that error? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_cUz6u6ceIaAtVw
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.
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
}
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?
If not, you should create a Portal Configuration on the connected account: https://stripe.com/docs/api/customer_portal/configurations/create
Then specify it when you create the Portal Session.