Cannot sync payouts to cards
See original GitHub issueDescribe the bug
When attempting to call Payout.sync_from_stripe_data
using a stripe response for a payout containing a card
destination, I receive the following error message:
NotImplementedError: Can't retrieve a bank account without a customer or account object. This may happen if not all accounts or customer objects are in the db. Please run "python manage.py djstripe_sync_models Account Customer" as a potential fix.
This seems to affect webhooks as well, I receive these errors:
ValueError: Trying to fit a 'card' into 'BankAccount'. Aborting.
djstripe.models.payment_methods.BankAccount.DoesNotExist: BankAccount matching query does not exist.
To Reproduce
- Enable stripe webhook to dj-stripe
- In stripe dashboard or via code create a payout object to a connect account. Some sample code:
account = user.stripe_account
transfer = stripe.Transfer.create(
amount=amount,
currency="usd",
destination=account.id,
)
transfer = Transfer.sync_from_stripe_data(transfer)
payout = stripe.Payout.create(
amount=amount,
currency="usd",
method="instant",
stripe_account=account.id,
)
# TODO: fix error for "Can't retrieve a bank account without a customer or
# account object."
payout = Payout.sync_from_stripe_data(payout)
return payout
- Error occurs
Expected behavior I expect to be able to sync Payouts correctly in both webhooks and manually.
Environment
- dj-stripe version: 2.7.0rc2
- Your Stripe account’s default API version: 2020-08-27
- Database: Postgres 14.1
- Python version: 3.9
- Django version: 4.0.7
Can you reproduce the issue with the latest version of master?
Yes
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Wallet not syncing Credit Cards? - Apple Community
To add cards to Apple Pay on your Apple Watch: On your iPhone, in the Watch app, go to: My Watch (tab) >...
Read more >Fix issues with saved payment info & passwords - Android
Instead, use your card by adding it to Google Pay: Go to pay.google.com. Add your info: Payment method: Select Payment Methods and then...
Read more >How Pay By Card payments sync - Support - BILL
Select Settings. · Select Preferences under Sync. · Select the edit icon. · Select the GL account related to each card account with...
Read more >How to sync a bank account with Reverb Payments
If there's no bank account on file, all payments will be sent to your Payout Balance. Jump to a section: Syncing your bank...
Read more >Unable to Add a Card to the Garmin Pay Wallet
If issues persist, contact the card issuing bank to verify it is Garmin Pay eligible. If you receive the message, There was an...
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
@jorgeavaldez contributions for said migration path are welcome, see the discussion in that issue. If you want to pick it up, read up and leave a message with any questions.
@jorgeavaldez thanks for the updates… yeah, a migration path is blocking the landing of #1638.