Skip to main content
Version: Next

SubscriptionSuspendModal

Used to make users suspend their subscription.

Loading...
info

SubscriptionSuspendModal requires the subscriptionToSuspend to be set.
If you're using our default flow, the user selects those before moving to payment already.
But if you have your own custom flow, you can use the usePelcro hook to set them before switching to the payment view like in the following example.

Usage#

import React from "react";
import {
SubscriptionSuspendModal,
PelcroModalController,
usePelcro,
} from "@pelcro/react-pelcro-js";
import "@pelcro/react-pelcro-js/dist/pelcro.css";
export const SubscriptionSuspendModal = () => {
const { switchView, setSubscriptionToSuspend} = usePelcro();
useEffect(() => {
setSubscriptionToSuspend(1847427);
}, []);
return (
<>
<button onClick={() => switchView('subscription-suspend')}>suspend subscription 1847427</button>
<PelcroModalController>
<SubscriptionSuspendModal />
</PelcroModalController>
</>
);
};

Reference#

Props#

onDisplay#

() โ‡’ void

Callback function called when the modal is first displayed.

onClose#

() โ‡’ void

Callback function called when the modal is closed.

onSuccess#

(userObject) โ‡’ void

Callback function called when the subscription suspended/unsuspended succesfully.

onFailure#

(errorObject) โ‡’ void

Callback function called when the subscription suspended/unsuspended fails.