question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot sync payouts to cards

See original GitHub issue

Describe 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

  1. Enable stripe webhook to dj-stripe
  2. 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

  1. 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:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jleclanchecommented, Oct 23, 2022

@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.

1reaction
jleclanchecommented, Oct 21, 2022

@jorgeavaldez thanks for the updates… yeah, a migration path is blocking the landing of #1638.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found