Skip to main content

Share API

Share API

shareForReward(options)

Executes a reward-based share. The share UI and reward decision are handled by the platform; the SDK only receives the final result.

Options:

ParameterTypeRequiredDescription
urlstring-URL to share
successfunction-Success callback
failfunction-Failure callback
completefunction-Completion callback

Success Response:

FieldTypeDescription
rewardedbooleanWhether reward was granted
errMsgstringResult message
TudadaSDK.shareForReward({
url: 'https://example.com/share',
success: (res) => {
if (res.rewarded) {
console.log('Share complete - reward granted');
}
},
fail: (err) => console.error('Share failed:', err.errMsg),
});

shareForRewardAsync(options)

Promise version of reward-based share.

Options:

ParameterTypeRequiredDescription
urlstring-URL to share

Return Value (Promise<ShareForRewardResult>):

FieldTypeDescription
rewardedbooleanWhether reward was granted
const result = await TudadaSDK.shareForRewardAsync();
if (result.rewarded) {
console.log('Share complete - reward granted');
}