Fix checkout flow to redirect to specific order detail page

🔄 Better UX Flow:
- After successful payment: redirect to /orders/{order_id} instead of /access
- This shows the specific order details where users can see their purchase
- Users can then proceed to payment if needed or access their content

📧 Updated Shortcodes:
- {thank_you_page} now uses dynamic URL pattern: /orders/{order_id}
- {order_id} will be replaced with actual order ID by ShortcodeProcessor
- Added {thank_you_page} to order_created and payment_reminder templates

🎯 User Journey:
1. User receives email with payment link
2. After successful payment → redirected to specific order detail page
3. If not logged in → redirects to login, then back to order detail
4. Order detail page shows payment status and access information

Much better user experience than generic dashboard redirect!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dwindown
2025-12-22 22:40:08 +07:00
parent 7fbc7c1302
commit f1cc2ba3f7
3 changed files with 5 additions and 5 deletions

View File

@@ -26,8 +26,8 @@ interface NotificationTemplate {
const RELEVANT_SHORTCODES = { const RELEVANT_SHORTCODES = {
'payment_success': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{produk}', '{link_akses}', '{thank_you_page}'], 'payment_success': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{produk}', '{link_akses}', '{thank_you_page}'],
'access_granted': ['{nama}', '{email}', '{produk}', '{link_akses}', '{username_akses}', '{password_akses}', '{kadaluarsa_akses}'], 'access_granted': ['{nama}', '{email}', '{produk}', '{link_akses}', '{username_akses}', '{password_akses}', '{kadaluarsa_akses}'],
'order_created': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{produk}', '{payment_link}'], 'order_created': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{produk}', '{payment_link}', '{thank_you_page}'],
'payment_reminder': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{batas_pembayaran}', '{jumlah_pembayaran}', '{bank_tujuan}', '{nomor_rekening}', '{payment_link}'], 'payment_reminder': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{batas_pembayaran}', '{jumlah_pembayaran}', '{bank_tujuan}', '{nomor_rekening}', '{payment_link}', '{thank_you_page}'],
'consulting_scheduled': ['{nama}', '{email}', '{tanggal_konsultasi}', '{jam_konsultasi}', '{durasi_konsultasi}', '{link_meet}', '{jenis_konsultasi}', '{topik_konsultasi}'], 'consulting_scheduled': ['{nama}', '{email}', '{tanggal_konsultasi}', '{jam_konsultasi}', '{durasi_konsultasi}', '{link_meet}', '{jenis_konsultasi}', '{topik_konsultasi}'],
'event_reminder': ['{nama}', '{email}', '{judul_event}', '{tanggal_event}', '{jam_event}', '{link_event}', '{lokasi_event}', '{kapasitas_event}'], 'event_reminder': ['{nama}', '{email}', '{judul_event}', '{tanggal_event}', '{jam_event}', '{link_event}', '{lokasi_event}', '{kapasitas_event}'],
'bootcamp_progress': ['{nama}', '{email}', '{judul_bootcamp}', '{progres_bootcamp}', '{modul_selesai}', '{modul_selanjutnya}', '{link_progress}'], 'bootcamp_progress': ['{nama}', '{email}', '{judul_bootcamp}', '{progres_bootcamp}', '{modul_selesai}', '{modul_selanjutnya}', '{link_progress}'],

View File

@@ -407,7 +407,7 @@ export class ShortcodeProcessor {
jumlah_pembayaran: 'Rp 1.500.000', jumlah_pembayaran: 'Rp 1.500.000',
batas_pembayaran: '22 Desember 2025 23:59', batas_pembayaran: '22 Desember 2025 23:59',
payment_link: 'https://accesshub.example.com/checkout', payment_link: 'https://accesshub.example.com/checkout',
thank_you_page: 'https://accesshub.example.com/access' thank_you_page: 'https://accesshub.example.com/orders/{order_id}'
}; };
static process(content: string, customData: Record<string, string> = {}): string { static process(content: string, customData: Record<string, string> = {}): string {

View File

@@ -67,7 +67,7 @@ export default function Checkout() {
if (order?.payment_status === "paid") { if (order?.payment_status === "paid") {
toast({ title: "Pembayaran berhasil!", description: "Akses produk sudah aktif" }); toast({ title: "Pembayaran berhasil!", description: "Akses produk sudah aktif" });
navigate("/access"); navigate(`/orders/${oid}`);
} else { } else {
toast({ title: "Pembayaran pending", description: "Menunggu konfirmasi pembayaran" }); toast({ title: "Pembayaran pending", description: "Menunggu konfirmasi pembayaran" });
} }
@@ -196,7 +196,7 @@ export default function Checkout() {
if (order?.payment_status === "paid") { if (order?.payment_status === "paid") {
toast({ title: "Pembayaran berhasil!", description: "Akses produk sudah aktif" }); toast({ title: "Pembayaran berhasil!", description: "Akses produk sudah aktif" });
navigate("/access"); navigate(`/orders/${orderId}`);
} else { } else {
toast({ title: "Belum ada pembayaran", description: "Silakan selesaikan pembayaran" }); toast({ title: "Belum ada pembayaran", description: "Silakan selesaikan pembayaran" });
} }