Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile Error when attempting to tokenize payment method #1954

Closed
claritydistro-nick opened this issue Nov 27, 2024 · 3 comments
Closed

Compile Error when attempting to tokenize payment method #1954

claritydistro-nick opened this issue Nov 27, 2024 · 3 comments
Labels

Comments

@claritydistro-nick
Copy link

Describe the bug

This documentation is the flow for attaching an external bank account to a connected account. The general flow is create SetupIntent -> display the FinancialConnections UI -> Receive a payment method id -> Tokenize the payment method -> Attach that to the connected account.

The tokenization code looks like:

// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
stripe.Key = "sk_test_51MpJbGHG00DxLhNtswrIgTH1MysmObg8ypgOLIhEoI6qRH61oJ5cv5Fn5YwvpYoLnzfRF1yd20EKvtl2pnYm5j5g00FhIM6KlJ"

params := &stripe.TokenParams{
  BankAccount: &stripe.BankAccountParams{
    PaymentMethod: stripe.String("{{PAYMENT_METHOD_ID}}"),
  },
  Customer: stripe.String("{{CUSTOMER_ID}}"),
};
params.SetStripeAccount("{{CONNECTED_ACCOUNT_ID}}")
result, err := token.New(params);

This results in a compile-time error:

unknown field PaymentMethod in struct literal of type "github.com/stripe/stripe-go/v81".BankAccountParams

I can confirm that this is indeed not defined in the most recent code on Github:

type BankAccountParams struct {

To Reproduce

  1. Implement the code referenced in the docs
  2. Attempt to compile

Expected behavior

Code compiles and runs

Code snippets

No response

OS

MacOS

Go version

1.21.6

stripe-go version

v81

API version

2020-08-27

Additional context

No response

@prathmesh-stripe
Copy link
Contributor

This is not intended an a bug. While we fix this issue, we recommend to use rawrequest to skirt around the limitation.

@claritydistro-nick
Copy link
Author

Excellent. Thank you for the workaround!

@helenye-stripe
Copy link
Contributor

The parameter should now be available in v81.1.1 with a temporary solution. We will fix this more completely in the next major.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants