Obtaining links
Obtain a link that you can deliver yourself
As an alternative to email delivery by Tremendous, you can also obtain direct links to rewards. It's then up to you to deliver the link to your recipient–by sharing the link in-app, on your website, through your own emails, or otherwise.
Placing an order for a LINK reward
To issue a link reward, specify "LINK"
as the delivery method for the reward:
curl --url 'https://testflight.tremendous.com/api/v2/orders' \
--header 'Authorization: Bearer YOUR-API-KEY' \
--header 'Content-Type: application/json' \
--data '
{
"payment": {
"funding_source_id": "BALANCE"
},
"reward": {
"value": {
"denomination": 50,
"currency_code": "USD"
},
"delivery": {
"method": "LINK"
},
"recipient": {
"name": "Jane Doe",
"email": "[email protected]"
},
"products": [
"OKMHM2X2OHYV"
]
}
}
'
You'll see the reward returned in the delivery hash as the value associated with the field "link"
, as shown in the response below:
{
"order": {
"id": "SFZCMH4NMC5X",
"external_id": null,
"created_at": "2023-01-10T21:44:06.441Z",
"status": "EXECUTED",
"channel": "API",
"payment": {
"subtotal": 50.0,
"total": 50.0,
"fees": 0.0
},
"rewards": [
{
"id": "4SBVBQGUZOGR",
"order_id": "SFZCMH4NMC5X",
"created_at": "2023-01-10T21:44:06.567Z",
"value": {
"denomination": 50.0,
"currency_code": "USD"
},
"delivery": {
"method": "LINK",
"status": "SUCCEEDED",
"link": "https://testflight.tremendous.com/rewards/payout/d0jgy1s8n--zkeqp-za8dbvrazboibjixi0cwxapb9r"
},
"recipient": {
"email": "[email protected]",
"name": "Jane Doe"
},
}
]
}
}
Obtaining a new link for an existing reward
Requests to
GET /reward/{reward_id}
will not contain the linkIf you make a subsequent request to
GET /reward/{reward_id}
, the "link" attribute will not be present. Tremendous treats links as passwords, and uses a one-way hashing algorithm such that a link cannot be retrieved after the moment that it is created.
If you need to obtain a new link for a reward, use the Generate a reward URL endpoint as follows, replacing REWARD-ID
in the URL with the ID of the reward for which you'd like to regenerate a link:
curl --request POST \
--header 'Authorization: Bearer YOUR-API-KEY' \
--url https://testflight.tremendous.com/api/v2/rewards/REWARD-ID/generate_link \
--header 'accept: application/json'
And that will return a new link:
{
"reward": {
"id": "O3KHKNGRVO9S",
"link":"https://testflight.tremendous.com/rewards/payout/9ehz3n0r8--k0wk6lxdq-q6nmwrc9lpeza8d-75asxj"
}
}
Note that generating a new link does not invalidate previous links- those will remain active as well.
Avoid storing links
Links should be treated as secrets. They allow anyone who has access to them to access the reward. We strongly advise you not to store links at all. Just generate a new link each time you need to render rewards.
If you elect to store anyway, (which, again, you shouldn’t), you must encrypt them, as you would any other secrets.
Updated 3 months ago