I set it up so that when you click a textbutton, it prompts you to buy a gamepass. Here's the code:
local plr = game.Players.LocalPlayer
local gpId = 1011985603
script.Parent.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptGamePassPurchase(plr, gpId)
end)
When the game is running and I click the button, instead of asking me to buy the gamepass, it says "Your purchase failed because something went wrong. Your account has not been charged. Please try again later." In the output it says "PurchasePromptScript: getProductInfo failed because MarketplaceService:getProductInfo() failed because HTTP 0 (HTTP 400 (HTTP/1.1 400 BadRequest)) Make sure a valid ID was specified"
This was done in a LocalScript inside the button. I tried this with various gamepass id's from very popular games and it still won't work. Any help?

6 comments
The error is self explanatory. Check the ID to see if it has any typos.
USE A CODE BLOCK or we will not want to help you. Error means you are not passing the ID of a gamepass
I checked the ID and it was the same as in the URL
Humm... Just checked the ID and it seems to be valid. Im stumped
do PromptPurchase, maybe that will work
Not sure why, but that worked. Thank you so much!