We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Document our plan to standardise on storing currency in cents
- [x] Add note on field classes that StripeQuantumCurrencyAmountField should be used for new fields
- [x] Update changelog about 3.0 migration to cents

_Originally posted by @therefromhere in https://github.com/dj-stripe/dj-stripe/issues/955#issuecomment-527251976_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `djstripe/fields.py`
Content:
```
1 """
2 dj-stripe Custom Field Definitions
3 """
4 import decimal
5 
6 from django.core.validators import MaxValueValidator, MinValueValidator
7 from django.db import models
8 
9 from .settings import USE_NATIVE_JSONFIELD
10 from .utils import convert_tstamp
11 
12 if USE_NATIVE_JSONFIELD:
13     from django.contrib.postgres.fields import JSONField as BaseJSONField
14 else:
15     from jsonfield import JSONField as BaseJSONField
16 
17 
18 class PaymentMethodForeignKey(models.ForeignKey):
19     def __init__(self, **kwargs):
20         kwargs.setdefault("to", "DjstripePaymentMethod")
21         super().__init__(**kwargs)
22 
23 
24 class StripePercentField(models.DecimalField):
25     """A field used to define a percent according to djstripe logic."""
26 
27     def __init__(self, *args, **kwargs):
28         """Assign default args to this field."""
29         defaults = {
30             "decimal_places": 2,
31             "max_digits": 5,
32             "validators": [MinValueValidator(1), MaxValueValidator(100)],
33         }
34         defaults.update(kwargs)
35         super().__init__(*args, **defaults)
36 
37 
38 class StripeCurrencyCodeField(models.CharField):
39     """
40     A field used to store a three-letter currency code (eg. usd, eur, ...)
41     """
42 
43     def __init__(self, *args, **kwargs):
44         defaults = {"max_length": 3, "help_text": "Three-letter ISO currency code"}
45         defaults.update(kwargs)
46         super().__init__(*args, **defaults)
47 
48 
49 class StripeQuantumCurrencyAmountField(models.IntegerField):
50     pass
51 
52 
53 class StripeDecimalCurrencyAmountField(models.DecimalField):
54     """
55     A field used to define currency according to djstripe logic.
56 
57     Stripe is always in cents. djstripe stores everything in dollars.
58     """
59 
60     def __init__(self, *args, **kwargs):
61         """Assign default args to this field."""
62         defaults = {"decimal_places": 2, "max_digits": 8}
63         defaults.update(kwargs)
64         super().__init__(*args, **defaults)
65 
66     def stripe_to_db(self, data):
67         """Convert the raw value to decimal representation."""
68         val = data.get(self.name)
69 
70         # Note: 0 is a possible return value, which is 'falseish'
71         if val is not None:
72             return val / decimal.Decimal("100")
73 
74 
75 class StripeEnumField(models.CharField):
76     def __init__(self, enum, *args, **kwargs):
77         self.enum = enum
78         choices = enum.choices
79         defaults = {"choices": choices, "max_length": max(len(k) for k, v in choices)}
80         defaults.update(kwargs)
81         super().__init__(*args, **defaults)
82 
83     def deconstruct(self):
84         name, path, args, kwargs = super().deconstruct()
85         kwargs["enum"] = self.enum
86         del kwargs["choices"]
87         return name, path, args, kwargs
88 
89 
90 class StripeIdField(models.CharField):
91     """A field with enough space to hold any stripe ID."""
92 
93     def __init__(self, *args, **kwargs):
94         """
95         Assign default args to this field.
96 
97         As per: https://stripe.com/docs/upgrades
98         You can safely assume object IDs we generate will never exceed 255
99         characters, but you should be able to handle IDs of up to that
100         length.
101         """
102         defaults = {"max_length": 255, "blank": False, "null": False}
103         defaults.update(kwargs)
104         super().__init__(*args, **defaults)
105 
106 
107 class StripeDateTimeField(models.DateTimeField):
108     """A field used to define a DateTimeField value according to djstripe logic."""
109 
110     def stripe_to_db(self, data):
111         """Convert the raw timestamp value to a DateTime representation."""
112         val = data.get(self.name)
113 
114         # Note: 0 is a possible return value, which is 'falseish'
115         if val is not None:
116             return convert_tstamp(val)
117 
118 
119 class JSONField(BaseJSONField):
120     """A field used to define a JSONField value according to djstripe logic."""
121 
122     pass
123
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/djstripe/fields.py b/djstripe/fields.py
--- a/djstripe/fields.py
+++ b/djstripe/fields.py
@@ -47,14 +47,22 @@
 
 
 class StripeQuantumCurrencyAmountField(models.IntegerField):
+    """
+    A field used to store currency amounts in cents (etc) as per stripe.
+    """
+
     pass
 
 
 class StripeDecimalCurrencyAmountField(models.DecimalField):
     """
-    A field used to define currency according to djstripe logic.
+    A legacy field to store currency amounts in dollars (etc).
+
+    Stripe is always in cents. Historically djstripe stored everything in dollars.
 
-    Stripe is always in cents. djstripe stores everything in dollars.
+    Note: Don't use this for new fields, use StripeQuantumCurrencyAmountField instead.
+    We're planning on migrating existing fields in dj-stripe 3.0,
+    see https://github.com/dj-stripe/dj-stripe/issues/955
     """
 
     def __init__(self, *args, **kwargs):

{"golden_diff": "diff --git a/djstripe/fields.py b/djstripe/fields.py\n--- a/djstripe/fields.py\n+++ b/djstripe/fields.py\n@@ -47,14 +47,22 @@\n \n \n class StripeQuantumCurrencyAmountField(models.IntegerField):\n+    \"\"\"\n+    A field used to store currency amounts in cents (etc) as per stripe.\n+    \"\"\"\n+\n     pass\n \n \n class StripeDecimalCurrencyAmountField(models.DecimalField):\n     \"\"\"\n-    A field used to define currency according to djstripe logic.\n+    A legacy field to store currency amounts in dollars (etc).\n+\n+    Stripe is always in cents. Historically djstripe stored everything in dollars.\n \n-    Stripe is always in cents. djstripe stores everything in dollars.\n+    Note: Don't use this for new fields, use StripeQuantumCurrencyAmountField instead.\n+    We're planning on migrating existing fields in dj-stripe 3.0,\n+    see https://github.com/dj-stripe/dj-stripe/issues/955\n     \"\"\"\n \n     def __init__(self, *args, **kwargs):\n", "issue": "Document our plan to standardise on storing currency in cents\n- [x] Add note on field classes that StripeQuantumCurrencyAmountField should be used for new fields\r\n- [x] Update changelog about 3.0 migration to cents\r\n\r\n_Originally posted by @therefromhere in https://github.com/dj-stripe/dj-stripe/issues/955#issuecomment-527251976_\n", "before_files": [{"content": "\"\"\"\ndj-stripe Custom Field Definitions\n\"\"\"\nimport decimal\n\nfrom django.core.validators import MaxValueValidator, MinValueValidator\nfrom django.db import models\n\nfrom .settings import USE_NATIVE_JSONFIELD\nfrom .utils import convert_tstamp\n\nif USE_NATIVE_JSONFIELD:\n    from django.contrib.postgres.fields import JSONField as BaseJSONField\nelse:\n    from jsonfield import JSONField as BaseJSONField\n\n\nclass PaymentMethodForeignKey(models.ForeignKey):\n    def __init__(self, **kwargs):\n        kwargs.setdefault(\"to\", \"DjstripePaymentMethod\")\n        super().__init__(**kwargs)\n\n\nclass StripePercentField(models.DecimalField):\n    \"\"\"A field used to define a percent according to djstripe logic.\"\"\"\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"Assign default args to this field.\"\"\"\n        defaults = {\n            \"decimal_places\": 2,\n            \"max_digits\": 5,\n            \"validators\": [MinValueValidator(1), MaxValueValidator(100)],\n        }\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n\nclass StripeCurrencyCodeField(models.CharField):\n    \"\"\"\n    A field used to store a three-letter currency code (eg. usd, eur, ...)\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        defaults = {\"max_length\": 3, \"help_text\": \"Three-letter ISO currency code\"}\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n\nclass StripeQuantumCurrencyAmountField(models.IntegerField):\n    pass\n\n\nclass StripeDecimalCurrencyAmountField(models.DecimalField):\n    \"\"\"\n    A field used to define currency according to djstripe logic.\n\n    Stripe is always in cents. djstripe stores everything in dollars.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"Assign default args to this field.\"\"\"\n        defaults = {\"decimal_places\": 2, \"max_digits\": 8}\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n    def stripe_to_db(self, data):\n        \"\"\"Convert the raw value to decimal representation.\"\"\"\n        val = data.get(self.name)\n\n        # Note: 0 is a possible return value, which is 'falseish'\n        if val is not None:\n            return val / decimal.Decimal(\"100\")\n\n\nclass StripeEnumField(models.CharField):\n    def __init__(self, enum, *args, **kwargs):\n        self.enum = enum\n        choices = enum.choices\n        defaults = {\"choices\": choices, \"max_length\": max(len(k) for k, v in choices)}\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n    def deconstruct(self):\n        name, path, args, kwargs = super().deconstruct()\n        kwargs[\"enum\"] = self.enum\n        del kwargs[\"choices\"]\n        return name, path, args, kwargs\n\n\nclass StripeIdField(models.CharField):\n    \"\"\"A field with enough space to hold any stripe ID.\"\"\"\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Assign default args to this field.\n\n        As per: https://stripe.com/docs/upgrades\n        You can safely assume object IDs we generate will never exceed 255\n        characters, but you should be able to handle IDs of up to that\n        length.\n        \"\"\"\n        defaults = {\"max_length\": 255, \"blank\": False, \"null\": False}\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n\nclass StripeDateTimeField(models.DateTimeField):\n    \"\"\"A field used to define a DateTimeField value according to djstripe logic.\"\"\"\n\n    def stripe_to_db(self, data):\n        \"\"\"Convert the raw timestamp value to a DateTime representation.\"\"\"\n        val = data.get(self.name)\n\n        # Note: 0 is a possible return value, which is 'falseish'\n        if val is not None:\n            return convert_tstamp(val)\n\n\nclass JSONField(BaseJSONField):\n    \"\"\"A field used to define a JSONField value according to djstripe logic.\"\"\"\n\n    pass\n", "path": "djstripe/fields.py"}], "after_files": [{"content": "\"\"\"\ndj-stripe Custom Field Definitions\n\"\"\"\nimport decimal\n\nfrom django.core.validators import MaxValueValidator, MinValueValidator\nfrom django.db import models\n\nfrom .settings import USE_NATIVE_JSONFIELD\nfrom .utils import convert_tstamp\n\nif USE_NATIVE_JSONFIELD:\n    from django.contrib.postgres.fields import JSONField as BaseJSONField\nelse:\n    from jsonfield import JSONField as BaseJSONField\n\n\nclass PaymentMethodForeignKey(models.ForeignKey):\n    def __init__(self, **kwargs):\n        kwargs.setdefault(\"to\", \"DjstripePaymentMethod\")\n        super().__init__(**kwargs)\n\n\nclass StripePercentField(models.DecimalField):\n    \"\"\"A field used to define a percent according to djstripe logic.\"\"\"\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"Assign default args to this field.\"\"\"\n        defaults = {\n            \"decimal_places\": 2,\n            \"max_digits\": 5,\n            \"validators\": [MinValueValidator(1), MaxValueValidator(100)],\n        }\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n\nclass StripeCurrencyCodeField(models.CharField):\n    \"\"\"\n    A field used to store a three-letter currency code (eg. usd, eur, ...)\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        defaults = {\"max_length\": 3, \"help_text\": \"Three-letter ISO currency code\"}\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n\nclass StripeQuantumCurrencyAmountField(models.IntegerField):\n    \"\"\"\n    A field used to store currency amounts in cents (etc) as per stripe.\n    \"\"\"\n\n    pass\n\n\nclass StripeDecimalCurrencyAmountField(models.DecimalField):\n    \"\"\"\n    A legacy field to store currency amounts in dollars (etc).\n\n    Stripe is always in cents. Historically djstripe stored everything in dollars.\n\n    Note: Don't use this for new fields, use StripeQuantumCurrencyAmountField instead.\n    We're planning on migrating existing fields in dj-stripe 3.0,\n    see https://github.com/dj-stripe/dj-stripe/issues/955\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"Assign default args to this field.\"\"\"\n        defaults = {\"decimal_places\": 2, \"max_digits\": 8}\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n    def stripe_to_db(self, data):\n        \"\"\"Convert the raw value to decimal representation.\"\"\"\n        val = data.get(self.name)\n\n        # Note: 0 is a possible return value, which is 'falseish'\n        if val is not None:\n            return val / decimal.Decimal(\"100\")\n\n\nclass StripeEnumField(models.CharField):\n    def __init__(self, enum, *args, **kwargs):\n        self.enum = enum\n        choices = enum.choices\n        defaults = {\"choices\": choices, \"max_length\": max(len(k) for k, v in choices)}\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n    def deconstruct(self):\n        name, path, args, kwargs = super().deconstruct()\n        kwargs[\"enum\"] = self.enum\n        del kwargs[\"choices\"]\n        return name, path, args, kwargs\n\n\nclass StripeIdField(models.CharField):\n    \"\"\"A field with enough space to hold any stripe ID.\"\"\"\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Assign default args to this field.\n\n        As per: https://stripe.com/docs/upgrades\n        You can safely assume object IDs we generate will never exceed 255\n        characters, but you should be able to handle IDs of up to that\n        length.\n        \"\"\"\n        defaults = {\"max_length\": 255, \"blank\": False, \"null\": False}\n        defaults.update(kwargs)\n        super().__init__(*args, **defaults)\n\n\nclass StripeDateTimeField(models.DateTimeField):\n    \"\"\"A field used to define a DateTimeField value according to djstripe logic.\"\"\"\n\n    def stripe_to_db(self, data):\n        \"\"\"Convert the raw timestamp value to a DateTime representation.\"\"\"\n        val = data.get(self.name)\n\n        # Note: 0 is a possible return value, which is 'falseish'\n        if val is not None:\n            return convert_tstamp(val)\n\n\nclass JSONField(BaseJSONField):\n    \"\"\"A field used to define a JSONField value according to djstripe logic.\"\"\"\n\n    pass\n", "path": "djstripe/fields.py"}]}