Saving transaction & customer info

This commit is contained in:
2024-08-12 19:10:27 +02:00
parent c3897d47bc
commit 5ab6ad85f7
4 changed files with 115 additions and 18 deletions

View File

@ -76,7 +76,7 @@ func (c *Card) RetrievePaymentIntent(id string) (*stripe.PaymentIntent, error) {
func (c *Card) SubscribeToPlan(
cust *stripe.Customer,
plan, email, last4, cardType string,
) (string, error) {
) (*stripe.Subscription, error) {
stripeCustomerID := cust.ID
items := []*stripe.SubscriptionItemsParams{
{Plan: stripe.String(plan)},
@ -92,9 +92,9 @@ func (c *Card) SubscribeToPlan(
params.AddExpand("latest_invoice.payment_intent")
subscription, err := subscription.New(params)
if err != nil {
return "", err
return nil, err
}
return subscription.ID, nil
return subscription, nil
}
func (c *Card) CreateCustomer(pm, email string) (*stripe.Customer, string, error) {