Redirect URLs
Overview
The Redirect URL feature in the Crossmint Pay Button allows users to specify a successCallbackURL
or failureCallbackURL
. Upon completion of the checkout process, customers are redirected to either of these URLs depending on the result of the operation.
<CrossmintPayButton
...
successCallbackURL='https://example.com/success'
failureCallbackURL='https://example.com/failure'
/>
Domain Whitelisting
For the callback URLs to function correctly, they need to be whitelisted through the developer console. Depending on the environment you are working in, you will need to access a different console.
For whitelisting in the staging environment, visit: https://staging.crossmint.com/console/domains
For the production environment, visit: https://www.crossmint.com/console/domains
You can whitelist multiple domains or subdomains for a project. localhost
, IPv4, and IPv6 addresses are valid options.
Redirection Payload
The Redirect URL feature utilizes HTTP status code 307 for redirection, ensuring that the method and the body of the original request are preserved in the redirected request.
This URL takes the customer to a success page with a p
query parameter. The p
parameter holds a URL-encoded JSON string containing detailed information about the transaction.
Here's an example of how a successful redirection URL with encoded payload would look like:
https://example.com/success?p=%5B%7B%22type%22%3A%22purchase.succeeded%22%2C%22status%22%3A%22success%22%2C%22walletAddress%22%3A%225ebsTfwNzpLur7qCmxT3MnDcyMQjbpMcQDaHAZNZ1iCF%22%2C%22clientId%22%3A%22e2803d1a-d87f-4586-9d98-7dfcaba226a8%22%2C%22txId%22%3A%224oM5Js9LiuRkYZ1oBNBX7b9A8imuS1p8YJLbcqe7Q1RM6AZfGBeL3g2ihcgofKt89VZXhbGeZKPgQ8cbPutpVsfq%22%2C%22email%22%3A%22alt.ha-8ob95g01%40yopmail.com%22%2C%22invoice%22%3A%7B%22orderIdentifier%22%3A%2267fa2b69-37af-40ec-981e-12dc68267b0e%22%2C%22items%22%3A%5B%7B%22transactionIdentifier%22%3A%22e31ec240-ab30-4da6-ab89-b96ab62acfcf%22%2C%22title%22%3A%22Frog%20%2365%22%2C%22imageUrl%22%3A%22https%3A%2F%2Fnftstorage.link%2Fipfs%2Fbafybeid4gihe2nnxlwdofvthmhargfczmtwxqzfur57xjoyrhs45eixmxa%2F65.png%22%2C%22expectedQuantity%22%3A1%2C%22actualQuantity%22%3A1%2C%22unitPrice%22%3A%7B%22amount%22%3A%222291%22%2C%22currency%22%3A%22usd%22%7D%2C%22price%22%3A%7B%22amount%22%3A%222291%22%2C%22currency%22%3A%22usd%22%7D%7D%5D%2C%22totalPrice%22%3A%7B%22amount%22%3A%222291%22%2C%22currency%22%3A%22usd%22%7D%7D%2C%22mintAddress%22%3A%22FZmCvLs3ewpxuMAr8Ki1ZZbSHDc9LGYgmWmPAQig7LVY%22%7D%5D
Below are examples of the payload for successful and failed operations.
Successful Purchase Operation
{
"success": true,
"payload": [
{
"type": "purchase.succeeded",
"status": "success",
"walletAddress": "5ebsTfwNzpLur7qCmxT3MnDcyMQjbpMcQDaHAZNZ1iCF",
"clientId": "f2803d1a-d87f-4586-9d98-7dfcaba226a8",
"txId": "4oM5Js9LiuRkYZ1oBNBX7b9A8imuS1p8YJLbcqe7Q1RM6AZfGBeL3g2ihcgofKt89VZXhbGeZKPgQ8cbPutpVsfq",
"mintAddress": "FZmCvLs3ewpxuMAr8Ki1ZZbSHDc9LGYgmWmPAQig7LVY"
}
]
}
Successful Prepay Operation
{
"success": true,
"payload": [
{
"type": "prepay.succeeded",
"status": "success",
"clientId": "f2803d1a-d87f-4586-9d98-7dfcaba226a8",
"userId": "645c7398edd90692c42e51e8",
"mintTo": "5ebsTfwNzpLur7qCmxT3MnDcyMQjbpMcQDaHAZNZ1iCF"
}
]
}
Failed Operation
{
"success": false,
"payload": [
{
"type": "purchase.failed",
"status": "failure",
"errorMessage": "Transaction failed",
"clientId": "f2803d1a-d87f-4586-9d98-7dfcaba226a8",
"txId": "e31ec240-ab30-4da6-ab89-b96ab62acfcf"
}
]
}
Updated 4 months ago