feat(payment): unify payment flow with new pure redirect entry and update related endpoints
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user