wave icon indicating copy to clipboard operation
wave copied to clipboard

Fix plan switching updating role if Paddle returns error

Open thinkverse opened this issue 2 years ago • 0 comments

Found an issue with the subscription plan switching on my Laravel 9 fork and decided to backport it here. The issue happens if the API call to Paddle happens to return an error, for instance, the plan_id exists in the APP but doesn't on Paddle. Or say the Paddle API happens to be down. The subscription doesn't update on Paddle's system but the users' role still changes.

This PR fixes this issue by only updating the users' role if we get a successful response from the Paddle API. It also now updates the plan_id on the subscription model.

thinkverse avatar May 15 '22 18:05 thinkverse