From 7140ed85126f80f486058d71f21971fa053e822e Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 7 May 2023 16:51:51 +0200 Subject: [PATCH] Feature/add stripe checkout to pricing page (#1942) * Add Stripe checkout directly to pricing page * Update changelog --- CHANGELOG.md | 4 +++ .../pages/account/account-page.component.ts | 8 ++++-- .../src/app/pages/account/account-page.html | 2 +- .../pages/pricing/pricing-page.component.ts | 28 ++++++++++++++++++- .../src/app/pages/pricing/pricing-page.html | 4 +-- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05ffe57ca..7312d57e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Added support for the _Stripe_ checkout to the pricing page + ### Changed - Improved the management of platforms in the admin control panel diff --git a/apps/client/src/app/pages/account/account-page.component.ts b/apps/client/src/app/pages/account/account-page.component.ts index 3c5c96152..8f039b177 100644 --- a/apps/client/src/app/pages/account/account-page.component.ts +++ b/apps/client/src/app/pages/account/account-page.component.ts @@ -189,9 +189,11 @@ export class AccountPageComponent implements OnDestroy, OnInit { .createCheckoutSession({ couponId: this.couponId, priceId: this.priceId }) .pipe( switchMap(({ sessionId }: { sessionId: string }) => { - return this.stripeService.redirectToCheckout({ - sessionId - }); + return this.stripeService.redirectToCheckout({ sessionId }); + }), + catchError((error) => { + alert(error.message); + throw error; }) ) .subscribe((result) => { diff --git a/apps/client/src/app/pages/account/account-page.html b/apps/client/src/app/pages/account/account-page.html index 717b07d3c..4db7e68f8 100644 --- a/apps/client/src/app/pages/account/account-page.html +++ b/apps/client/src/app/pages/account/account-page.html @@ -32,7 +32,7 @@

One-time payment, no auto-renewal.