Integrations
Grant rewards from a scene
Recommended dispenser flags
Example
import { getPlayer } from '@dcl/sdk/src/players'
import { signedFetch } from '@decentraland/SignedFetch'
import { getRealm } from '~system/Runtime'
export function main() {
// 1. Get captcha challenge to show to the user
const request = await fetch(`https://rewards.decentraland.org/api/captcha`, {
method: 'POST',
})
const captcha = await request.json()
// 2. Display captcha for player to complete - See example in studios.decentraland.org/resources
// 3. Get user data
const user = getPlayer()
// 4. Get current realm
const realmInfo = await getRealm({})
// 5. Send request to assign a wearable/emote
const assignRequest = await signedFetch('https://rewards.decentraland.org/api/rewards', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
campaign_key: '[DISPENSER_KEY]', // dispenser key
beneficiary: user.userId, // ethereum address
catalyst: realmInfo.baseUrl, // catalyst domain
captcha_id: captcha.data.id, // "9e6b2d07-b47b-4204-ae87-9c4dea48f9b7"
captcha_value: '[CAPTCHA_VALUE]', // "123456"
}),
})
const reward = await assignRequest.json()Grant rewards from a Decentraland Quests
Recommended dispenser flags
Example
Grant rewards from a custom server
Recommended dispenser flags
Example
Last updated