Skip to main content
Version: Next

GiftRedeemModal

The gift redeem modal is used when the user wants to start the flow of redeeming a gift code. once the user submits a gift code successfully in this modal, the code is stored in usePelcro's giftCode field, and if the gifted plan requires an address, then it takes you to the address select/create modal first before the gift is succesfully redeemed, otherwise the gift is redeemd right away.

Loading...

Usage#

import React from "react";
import {
GiftRedeemModal,
PelcroModalController,
usePelcro,
} from "@pelcro/react-pelcro-js";
import "@pelcro/react-pelcro-js/dist/pelcro.css";
export const GiftRedeemExample = () => {
const { switchView } = usePelcro();
return (
<>
<button onClick={() => switchView("gift-redeem")}>Redeem gift</button>
<PelcroModalController>
<GiftRedeemModal />
</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#

(giftCode) โ‡’ void

Callback function called when the gift code is submitted succesfully.

onFailure#

(errorObject) โ‡’ void

Callback function called when submitting the gift code fails.