If you have an active monthly subscription and upgrade to yearly, then you will only pay the difference. For example, if you purchase a $39/month plan and then upgrade to a $300/year plan on the same day, you will see charges of $39 and $261 ($300 - $39). The difference will change with each passing day, as DataCamp's upgrades factor time passed.
If you have canceled your subscription before upgrading, then you will be charged the full amount for an upgrade. If you still have time left in your canceled subscription, contact DataCamp Support Team, who can reactivate your monthly subscription before you upgrade.
For Mobile Subscriptions
As mobile subscriptions are managed by either the Google Play Store or the Apple App Store, the way the upgrade works varies depending on the store. You can find the details in the following article: DataCamp Mobile Subscriptions
What happens if I have the GitHub Students benefit?
If you are enjoying the 3-month free access benefit from GitHub and decide to upgrade to a Premium plan, the new subscription will start right away, and any remaining free-trial time will end once the paid plan begins. For more details, please visit: How to Get 3 Months of Free Access to DataCamp with GitHub Student Benefits