Card should not be required for all payment methods
See original GitHub issueDescribe the bug Card is currently not nullable which breaks with payment methods that don’t use a card such as SEPA Direct Debit.
To Reproduce Steps to reproduce the behavior:
- Make a charge using SEPA Direct Debit
- See attached error on webhook
Expected behavior
A created payment method (and dependents)
Environment
- dj-stripe==2.3.0
- stripe==2.55.0
- Django==3.0.11
- Python 3.7.9 (default, Sep 3 2020, 01:19:43)
- PostgreSQL 11.5
- dj-stripe version: [e.g. master at <hash>, 2.0.0 etc]
- Stripe API: 2020-08-27
Can you reproduce the issue with the latest version of master?
Yes, because card
is still not nullable: https://github.com/dj-stripe/dj-stripe/blob/db7c7dd30a8853aec3477c3064fb5cf3c887fdde/djstripe/models/payment_methods.py#L516-L519
Traceback of the issue
Traceback (most recent call last):
File "site-packages/djstripe/models/base.py", line 621, in _get_or_create_from_stripe_object
stripe_account=stripe_account,
File "site-packages/djstripe/models/base.py", line 513, in _create_from_stripe_object
instance.save(force_insert=True)
File "site-packages/django/db/models/base.py", line 749, in save
force_update=force_update, update_fields=update_fields)
File "site-packages/django/db/models/base.py", line 787, in save_base
force_update, using, update_fields,
File "site-packages/django/db/models/base.py", line 890, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File "site-packages/django/db/models/base.py", line 929, in _do_insert
using=using, raw=raw,
File "site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "site-packages/django/db/models/query.py", line 1204, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "site-packages/django/db/models/sql/compiler.py", line 1394, in execute_sql
cursor.execute(sql, params)
File "site-packages/cacheops/transaction.py", line 93, in execute
result = self._no_monkey.execute(self, sql, params)
File "site-packages/sentry_sdk/integrations/django/__init__.py", line 489, in execute
return real_execute(self, sql, params)
File "site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: null value in column "card" violates not-null constraint
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Guide to Payment Types, With Pros and Cons for Each
A payment can be made in the form of cash, check, wire transfer, credit card, or debit card. More modern methods of payment...
Read more >Payment Options - Practical Business Skills
Many customers will expect you to accept cash. You won't have to pay any fees to accept cash. Customers might not want to...
Read more >10 Best Practices for Card Not Present Transactions - Insights
General payment practices; Avoiding chargebacks; Interchange, assessments, and fee structures; Address Verification Service; Card security checks; Recurring ...
Read more >PCI Compliance Guide Frequently Asked Questions | PCI DSS ...
A: If you accept credit or debit cards as a form of payment, then PCI compliance applies to you. The storage of card...
Read more >A guide to types of payment methods - Stripe
If you don't create a relevant, familiar payment experience, you could cut off ... debit payments are all reusable—customers only need to provide...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome! Thank you for the quick fix. I’ll try it right away.
As for sponsoring. The project I’m working on is currently in the proof-of-concept phase so there’s no money to go around yet. If it takes off though, I’ll throw a few bucks your way 😃
Sounds good! 2.4 is slated for release this week. If you’re running off master, make sure to run all the migrations up to the current commit before upgrading to the final release. And please do report any other issues you find!