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.

Extra/Empty Customer Instance Created During Checkout

See original GitHub issue

Describe the bug

DJ-stripe is creating an additional customer object for each of my real Stripe customers upon creation. This extra (blank) customer is the one that is related to my User model, so when I try to access Stripe Customer data via the authenticated User on my site, the data comes back empty. The original Stripe Customer object (with all of the correct data) still lives in my database but is not related to a User.

I don’t know if this is a bug or an implementation issue on my end, but if this rings a bell for anyone I’d appreciate your help. I am 99% finished with my integration, but I am unable to ship the Stripe Customer Portal because it is using the blank/extra Stripe Customer and therefore does not display any data as it should.

Software versions

  • dj-stripe version: 2.5
  • Python version: 3.8.0
  • Django version: 3.2
  • Stripe API version: 2020-08-27
  • Database type and version: psql (PostgreSQL) 13.2

Steps To Reproduce

This is my local configuration - to reproduce the issue your environment should match up with: STRIPE_TEST_SECRET_KEY = reach out to dev team for this STRIPE_TEST_PUBLIC_KEY = reach out to dev team for this DJSTRIPE_WEBHOOK_SECRET = reach out to dev team for this DJSTRIPE_WEBHOOK_VALIDATION = "verify_signature" DJSTRIPE_USE_NATIVE_JSONFIELD = True DJSTRIPE_FOREIGN_KEY_TO_FIELD = "djstripe_id" DJSTRIPE_SUBSCRIBER_MODEL = "myApp.User" DJSTRIPE_SUBSCRIBER_CUSTOMER_KEY = "djstripe_subscriber" DJSTRIPE_WEBHOOK_URL=r"^stripe/\$"

If you have a matching backend configuration and a frontend which allows you to complete the Stripe checkout process, you can reproduce the issue. Simply go through the standard Stripe checkout flow and then check your database to see if two records were created instead of one. One should have the full data that you entered in Checkout (credit card number, subscription, etc.) and the other one should simply have the name and email address.

Better yet, if you have the Stripe Customer Portal integrated on your frontend you may be able to see what I mean when the empty/inactive/extra Stripe Customer ID is presented instead of the one that maps to the request user.

Can you reproduce the issue with the latest version of master?

I believe so

Expected Behavior

I expect DJ-stripe to relate the request User with the corresponding Stripe Customer instance so that I can query and access this data on my frontend and allow users to interact with the Stripe Customer Portal to manage their membership.

Actual Behavior

There should be two database records and two Stripe customers viewable in your Stripe dashboard with the same email address. One of them will also have customer data such as payment method. The other one will be empty beyond email/name. The empty one will be related to an instance of <yourApp>.User.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:52 (24 by maintainers)

github_iconTop GitHub Comments

1reaction
arnav13081994commented, Dec 22, 2021

Hi @Hafnernuss,

Yes that’s the plan.

1reaction
alecdaleliocommented, Nov 4, 2021

@arnav13081994 Excellent! I’ll be traveling today but I’ll let you know as soon as I’m able to look it over and implement it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cogent NGS Immune Profiler Software notices - Takara Bio
Learn more about troubleshooting guidelines and software notices for the Cogent NGS Immune Profiler Software.
Read more >
Magento 2 Documentation: 2.3.0
Implemented persistence of entered customer's data on Checkout flow ... Preferences, shared instance creation and compiled factory accelerated by 3% ...
Read more >
(The only proper) PDO tutorial - Treating PHP Delusions
Thus, a sole PDO instance has to be created and then used through whole script execution. ... because you have to clear that...
Read more >
Test Planning and Management with Azure Test Plans
This project will guide you through creating test plans designed to efficiently ... Select the suite of tests for the story As a...
Read more >
CS-Cart 3.0.1 Changelog
Pagination: Ellipsis replaced with page ranges in customer area. ... to be created on the second checkout step if Multiple Page Checkout was...
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