Posting possible solution that worked for me below.
I also had similar problem for 1 month +, tried to purchase from Web and Developer app, had "Purchasing failed" from both of the platforms.
I tried 2 different solutions for myself, so not sure which one eventually worked for me, but feel free to try both:
Solution 1: For some reason, on my iPhone settings -> click on your name -> Sign-in & Security, my phone number had warning next to it ("This phone number has to have SIM card ....."), not sure why, because i have SIM card on my phone. Fix was to enable iMessage in iPhone settings -> Messages, and enable iMessage.
Solution 2: Initially everywhere i tried to pay with Apple Pay (Wallet app), which always gave me an error "Purchasing failed", i tried removing ALL cards from my Wallet app, so i only had my default payment method left (Which you can add in iPhone settings -> click on your name -> Payment & Shipping), paying through that i finally got Success message.
Wishing you all good luck, hopefully one of the fixes mentioned in this 30+ pages thread will work for you.