Created
May 17, 2018 01:14
-
-
Save andresprogra/72dc7ddbb2aa52c4a93390c0fb127e65 to your computer and use it in GitHub Desktop.
Function CreatePlanStripe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func CreatePlanStripe(planObj Plan) (*stripe.Plan, error){ | |
stripe.Key = "key" | |
params := &stripe.PlanParams{ | |
Amount: planObj.Amount, | |
// planObj.Period es de tipo string pero me da error, dice: | |
// cannot use planObj.Period (type string) as type stripe.PlanInterval in field value | |
// pero si yo le pongo directamente un string ("month") no da error. | |
Interval: planObj.Period, | |
// El mismo error que con Interval | |
Currency: planObj.Currency, | |
IntervalCount: planObj.IntervalCount, | |
TrialPeriod: planObj.TrialPeriodDays, | |
Product: &stripe.PlanProductParams{ | |
Name: planObj.Name + " - " + string(planObj.LimitUsers) + " USERS", | |
}, | |
} | |
p, err := plan.New(params) | |
return p, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hola Andrés!
La línea 8 debería ser más o menos así:
Lo que pasa es que seguramente el tipo de dato
stripe.PlanInterval
está declarado como alias destring
y por tantoInterval
no puede recibir una cadena plana como valor, pues espera unstripe.PlanInterval
; lo mismo debe pasar conCurrency
; debe esperar un tipo de datosstripe.PlanCurrency
o algo similar.