瀏覽代碼

Remove Stripe customer prefix

Mauricio Araujo 2 年之前
父節點
當前提交
3af6621d52
共有 1 個文件被更改,包括 3 次插入5 次删除
  1. 3 5
      internal/billing/stripe.go

+ 3 - 5
internal/billing/stripe.go

@@ -36,19 +36,17 @@ func (s StripeClient) CreateCustomer(ctx context.Context, userEmail string, proj
 	defer span.End()
 
 	if projectID == 0 || projectName == "" {
-		return "", fmt.Errorf("invalid project id or name")
+		return "", telemetry.Error(ctx, span, err, "invalid project id or name")
 	}
 
 	stripe.Key = s.SecretKey
 
-	// Create customer if not exists
-	customerName := fmt.Sprintf("project_%s", projectName)
 	projectIDStr := strconv.FormatUint(uint64(projectID), 10)
 	params := &stripe.CustomerParams{
-		Name:  stripe.String(customerName),
+		Name:  stripe.String(projectName),
 		Email: stripe.String(userEmail),
 		Metadata: map[string]string{
-			"porter_project_id": projectIDStr,
+			"project_id": projectIDStr,
 		},
 	}