#edutomesco

1 messages · Page 1 of 1 (latest)

drowsy jasperBOT
tardy isle
#

hi! so what are you trying to do exactly? delete a specific tax ID? delete all tax IDs?

obtuse flax
#

No

#

this error goes when i execute this

#

if _, err := paymentmethod.Detach(paymentMethodID, nil); err != nil {
s.logger.Error().Err(err).Msg("")
return err
}
return nil
}

#

nothing with the taxID

tardy isle
#

hmm

#

let me look into it

#

do you have more context on how I might reproduce this?

#

I did this script just now and it works fine and deletes a PaymentMethod

#
package main

import (
    "fmt"
    "github.com/stripe/stripe-go/v73"
    "github.com/stripe/stripe-go/v73/customer"
    "github.com/stripe/stripe-go/v73/paymentmethod"
)

func main() {
    stripe.Key = "sk_test_xxxx"

    customerParams := &stripe.CustomerParams{
      Email: stripe.String("test@example.com"),
      PaymentMethod :stripe.String("pm_card_visa"),
    }
    customer, _ := customer.New(customerParams)

    // get hte ID of the payment method added
    params := &stripe.PaymentMethodListParams{
      Customer: &customer.ID,
      Type: stripe.String("card"),
    }
    i := paymentmethod.List(params)
    for i.Next() {
      pm := i.PaymentMethod()
      // delete it
      pm_deleted, _ := paymentmethod.Detach(
        pm.ID,
        nil,
      )
      fmt.Printf("Deleted a PM: %v\n", pm_deleted.ID)

    }
}