gocodebox / gocodebox/lifterlms

Switching timezones can cause incorrect double charges

Open
#2,889 1 comment 0 reactions 1 assignee Assigned to @brianhogg View on GitHub
Dominant language
PHP
Stars
212
Forks
140
Avg merge
2d 14h
Merged PRs (30d)
19

Description

### Reproduction Steps

There are likely other scenarios that can cause the same problem, and trial is likely not needed, but it's one scenario to test.

1. With the site timezone in UTC, purchase a monthly recurring access plan with a 1 day trial.
2. Switch the site to UTC-6 timezone
3. Wait a couple days for the renewal to happen

### Expected Behavior

One recurring charge happens for the monthly access plan, and the next payment date is at the same time (timezone adjusted)

### Actual Behavior

Two recurring charges happen on the same day, and the next payment date is 6 hours ahead. The first charge happens as the original time due to the task already being scheduled.

### Tech Notes

The next payment date is stored in the current local timezone. It's then interpreted as the new timezone when read on renewal.

![Image](https://github.com/user-attachments/assets/9f48a0a2-e431-4f7f-bab5-49b8c1d87126)
Next payment date is set to the same time, but in the new time zone, since it appears to be in the future. The first (original) payment happened at the time in the old timezone. There's a check that the next payment isn't within 2 hours in case of daylight savings time, but that doesn't account for a totally different timezone that's more than that 2 hour difference.

![Image](https://github.com/user-attachments/assets/c836318d-9167-44d3-9734-0677b7f25db9)

Next recurring payment scheduled task in the new time zone.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.