Verify and Redeem an email claim
You can verify and redeem an email claim using the Phosphor API.
Verify
Issue a POST
request to the public
verify
endpoint with the claim token to generate the security code.
POST https://public-api.phosphor.xyz/v1/email-claims/{claim_token}/verify
Example response
{
"attributes": {
"Artist Name": "Joel",
"Date of Creation": "2022-03-30",
"description": "This is a piece representing diversity in women.",
"image_url": "https://nftstagingstorage.blob.core.windows.net/public/QmRexc74GRU4NNZccMXKZvWf9dzXCzZwBWHLekjaeSrRZn/joel-muniz-DcxN4xWdEYs-unsplash.jpg",
"title": "IWD2"
},
"collection_id": "e0fe1317-e42d-40ea-85bd-9fcf8354971f",
"id": "ef57bb80-4279-423d-8f25-f011faea7f7b",
"listing": null,
"media": {
"image": {
"cid": "QmRexc74GRU4NNZccMXKZvWf9dzXCzZwBWHLekjaeSrRZn",
"full": "https://media-resize-stg.phosphor.xyz/resize/?cid=QmRexc74GRU4NNZccMXKZvWf9dzXCzZwBWHLekjaeSrRZn&image=joel-muniz-DcxN4xWdEYs-unsplash.jpg&size=full",
"original": "https://media-resize-stg.phosphor.xyz/resize/?cid=QmRexc74GRU4NNZccMXKZvWf9dzXCzZwBWHLekjaeSrRZn&image=joel-muniz-DcxN4xWdEYs-unsplash.jpg&size=original",
"thumb": "https://media-resize-stg.phosphor.xyz/resize/?cid=QmRexc74GRU4NNZccMXKZvWf9dzXCzZwBWHLekjaeSrRZn&image=joel-muniz-DcxN4xWdEYs-unsplash.jpg&size=thumb",
"tiny": "https://media-resize-stg.cphosphor.xyz/resize/?cid=QmRexc74GRU4NNZccMXKZvWf9dzXCzZwBWHLekjaeSrRZn&image=joel-muniz-DcxN4xWdEYs-unsplash.jpg&size=tiny"
}
},
"token_contract": {
"address": "0x774A130d027D441F7F371c7ecA83AD1ad3789330",
"capabilities": [
"ERC1155",
"ERC1155_METADATA_URI",
"WITHDRAW_TOKENS_TO",
"TOKEN_MINT_PRICES",
"DEPRECATED_ADMIN_MINT",
"OZ_OWNABLE",
"MANAGE_SUPPLY",
"SET_BASE_URI"
],
"deploy_tx_id": null,
"network_id": 59140,
"symbol": "IWD",
"token_type": "ERC1155",
"tx_hash": null
},
"token_id": "2"
}
Redeem
POST https://public-api.phosphor.xyz/v1/email-claims/{claim_token}/redeem
Example payload
{
"address": "ethereum-wallet-address",
"pin": "security-code-from-email"
}
The response status
is CLAIMED
if the NFT is claimed successfully.
Example response
{
"status": "CLAIMED",
"voucher": null
}
If tx_payer
is set to BUYER
, a voucher
might be returned in the response. The voucher
entitles the minter
to call the smart contract with the specified contract
address. The smart contract validates that the signature is by the authorized signer, and performs the mint.
Example response
{
"status": "CLAIMED",
"voucher": {
"contract": "0x774A130d027D441F7F371c7ecA83AD1ad3789330",
"currency": null,
"expiry": "2022-09-14T22:28:39.815092+00:00",
"id": "01aa9661-8fd4-4826-a2d0-0360dcc85beb",
"minter": "0x86e1678D75D9249F6A60c8aD76dd8dFF49225d18",
"network_id": 59140,
"nonce": 0,
"price": "0",
"quantity": 1,
"signature": "0x4e852671d0f0ab81bda06160c7455af3a7e22fccbd5a90a1e8451f8cacf4b16d2768c1d4ea76a3c5c732edb896fe02fe0b08c46a0ea97708bae309cad0c9712e1c",
"token_id": null
}
}
You can use third-party libraries such as ethers.js
and web3.js
to call the contract.