Post-purchase
Know when your customer finishes checking out with Winter.
successfulWinterCheckout
function handleWindowEvent(event) {
if (event.data.name === "closeWinterCheckoutModal") {
// properly close the winter modal so it can be opened again
setShowWinter(false)
} else if (event.data.name === 'successfulWinterCheckout') {
// Successfully checked out. This event contains information
// You can see the full message body below
// you can use to continue the flow:
console.log(event.data.transactionHash) // do what you need with the txhash here!
console.log(event.data.email) // email that the user bought an NFT with
console.log(event.data.nftQuantity) // the number of NFTs bought
console.log(event.data.amountUSD) // the price of the purchase in cents
console.log(event.data.nftTokenIds) // the token ids of each nft purchased
console.log(event.data.nftUrls) // the url for the image of each NFT
console.log(event.data.openseaUrls) // the opensea url for each NFT purchased
}
}
useEffect(() => {
window.addEventListener("message", handleWindowEvent)
return () => window.removeEventListener("message", handleWindowEvent)
}, [])Last updated