curl --request POST \
--url https://api.promostack.app/referrer-claim \
--header 'Content-Type: application/json' \
--data '
{
"uid": "<string>"
}
'{
"error": {
"code": "NO_REWARDS_AVAILABLE",
"message": "No rewards available to claim"
}
}
Claim available rewards
curl --request POST \
--url https://api.promostack.app/referrer-claim \
--header 'Content-Type: application/json' \
--data '
{
"uid": "<string>"
}
'{
"error": {
"code": "NO_REWARDS_AVAILABLE",
"message": "No rewards available to claim"
}
}
/referrer)curl -X POST https://api.promostack.app/referrer-claim \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"uid": "user_123"
}'
Show properties
ios or android{
"message": "Successfully claimed 1 reward",
"claimed_rewards": [
{
"reward_id": "660e8400-e29b-41d4-a716-446655440000",
"platform": "ios",
"code": "LOGI-REWARD-ABC123",
"reward_number": 1,
"instructions": "Copy this code and redeem in App Store",
"store_url": "https://apps.apple.com/account/redeem"
}
]
}
func claimRewards(userId: String) async throws -> ClaimResponse {
let url = URL(string: "https://yejzycmzbcwjsapmkwrq.supabase.co/functions/v1/referrer-claim")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue(apiKey, forHTTPHeaderField: "x-api-key")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body = ["uid": userId]
request.httpBody = try JSONEncoder().encode(body)
let (data, _) = try await URLSession.shared.data(for: request)
return try JSONDecoder().decode(ClaimResponse.self, from: data)
}
// Display claimed rewards
func showClaimedRewards(_ response: ClaimResponse) {
let alert = UIAlertController(
title: "🎉 Rewards Claimed!",
message: response.message,
preferredStyle: .alert
)
for reward in response.claimed_rewards {
alert.addAction(UIAlertAction(title: "Copy \(reward.code)", style: .default) { _ in
UIPasteboard.general.string = reward.code
UIApplication.shared.open(URL(string: reward.store_url)!)
})
}
alert.addAction(UIAlertAction(title: "Done", style: .cancel))
present(alert, animated: true)
}
{
"error": {
"code": "NO_REWARDS_AVAILABLE",
"message": "No rewards available to claim"
}
}
Check Progress First
/referrer to see if rewards are availableShow Claim Button
rewards_earned > 0, show a “Claim Rewards” buttonClaim on User Action
/referrer-claim when user taps the buttonDisplay Codes
{
"message": "Successfully claimed 2 rewards",
"claimed_rewards": [
{
"reward_id": "...",
"platform": "ios",
"code": "LOGI-REWARD-ABC123",
"reward_number": 1,
...
},
{
"reward_id": "...",
"platform": "ios",
"code": "LOGI-REWARD-XYZ789",
"reward_number": 2,
...
}
]
}