#HOW CAN I FIX THIS SO IT DOESN'T HAVE THE ``HTTP ERROR REQUEST 400``

1 messages · Page 1 of 1 (latest)

spice meadow
#
ProductId = 3286624804
MarketplaceService = game:GetService("MarketplaceService")
HTTPService = game:GetService("HttpService")
Webhook_URL = 'https://webhook.lewisakura.moe/api/webhooks/########'

game.Players.PlayerAdded:Connect(function(player)
    MarketplaceService.PromptProductPurchaseFinished:Connect(function(userid, id, ifpurchased)
        if ifpurchased then
            local Data = {
                ["content"] = "",
                ["embeds"] = {{
                    ["title"] = "**New Developer Product Purchased**" ,
                    ["description"] = player.Name .. " **Has Purchased a product worth 1 Robux**",
                    ["type"] = "rich",
                    ["color"] = 4972305,
                    ["thumbnail"] = {
                        ["url"] = 'rbxthumb://type=AvatarBust&id='..player.UserId..'&w=180&h=180'},
                    ["fields"] = {
                        {
                            ["name"] = " Product Purchased ",
                            ["value"] = id, 
                            ["inline"] = true
                        },
                        {
                            ['name'] = "User ID: ",
                            ['value'] = userid,
                            ['inline'] = true
                        }
                    }
                }}
            }
            Data = HTTPService:JSONEncode(Data)
            HTTPService:PostAsync(Webhook_URL, Data)
        end
    end)
end)
pseudo fog
#

should really use processreceipt for marketplace transactions. not sure about your http endpoint though, that's on you

#

assuming you've already enabled http services in the game settings