Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/set user id in stripe callback (#184)

Thomas367f25a975a5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab9af74b2e..49ec5f731e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## Unreleased
+
+### Added
+
+- Set the user id in the _Stripe_ callback
+
## 1.21.0 - 22.06.2021
### Changed
diff --git a/apps/api/src/app/subscription/subscription.service.ts b/apps/api/src/app/subscription/subscription.service.ts
index 02fee3fb49..4f92079227 100644
--- a/apps/api/src/app/subscription/subscription.service.ts
+++ b/apps/api/src/app/subscription/subscription.service.ts
@@ -38,9 +38,6 @@ export class SubscriptionService {
quantity: 1
}
],
- metadata: {
- user_id: userId
- },
mode: 'payment',
payment_method_types: ['card'],
success_url: `${this.configurationService.get(
@@ -81,6 +78,10 @@ export class SubscriptionService {
}
}
});
+
+ await this.stripe.customers.update(session.customer as string, {
+ description: session.client_reference_id
+ });
} catch (error) {
console.error(error);
}