feat(payment): unify payment flow with new pure redirect entry and update related endpoints

This commit is contained in:
hamed
2026-07-02 17:08:50 +03:30
parent c247ac2c80
commit 7f5c65129c
17 changed files with 720 additions and 82 deletions
+4 -1
View File
@@ -83,7 +83,10 @@ export default function SubscriptionPage() {
const purchaseMutation = useMutation({
mutationFn: ({ period_uuid, gateway, amount_rials }: { period_uuid: string; gateway: string; amount_rials: number }) =>
api.post<{ data: { payment_url: string } }>('/api/v1/subscription-payment', { period_uuid, gateway, amount_rials }),
api.post<{ data: { payment_url: string } }>('/api/v1/subscription-payment', {
period_uuid, gateway, amount_rials,
frontend_address: `${window.location.origin}/admin/subscription`,
}),
onSuccess: (res: any) => {
const url = res?.data?.pay_url ?? res?.data?.redirect_url ?? res?.data?.payment_url;
if (url) window.location.href = url;