Paypal integration improvements
This commit is contained in:
@@ -70,18 +70,26 @@ export default function PayPalPayment({
|
||||
throw new Error("trackingId is not set");
|
||||
}
|
||||
|
||||
const request = await axios.post<{ ok: boolean; reason?: string }>(
|
||||
"/api/paypal/approve",
|
||||
{ id: data.orderID, duration, duration_unit, trackingId }
|
||||
);
|
||||
axios
|
||||
.post<{ ok: boolean; reason?: string }>("/api/paypal/approve", {
|
||||
id: data.orderID,
|
||||
duration,
|
||||
duration_unit,
|
||||
trackingId,
|
||||
})
|
||||
.then((request) => {
|
||||
if (request.status !== 200) {
|
||||
toast.error("Something went wrong, please try again later");
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.status !== 200) {
|
||||
toast.error("Something went wrong, please try again later");
|
||||
return;
|
||||
}
|
||||
|
||||
toast.success("Your account has been credited more time!");
|
||||
return onSuccess(duration, duration_unit);
|
||||
toast.success("Your account has been credited more time!");
|
||||
return onSuccess(duration, duration_unit);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
toast.error("Something went wrong, please try again later");
|
||||
});
|
||||
};
|
||||
|
||||
const onError = async (data: Record<string, unknown>) => {
|
||||
|
||||
Reference in New Issue
Block a user