jazzband / django-payments

Universal payment handling for Django.
https://django-payments.readthedocs.io
Other
1.06k stars 282 forks source link

Error when make payments locally #424

Open paulocoutinhox opened 1 month ago

paulocoutinhox commented 1 month ago

Hi,

Im trying test this library.

But when i listen locally with stripe cli and make a local payment it only give me error:

Stripe CLI:

2024-09-19 21:49:18   --> payment_intent.succeeded [evt_3Q0v28EUm7G1T8P41FYyqdPh]
2024-09-19 21:49:18   --> charge.succeeded [evt_3Q0v28EUm7G1T8P413Bt8fVq]
2024-09-19 21:49:18  <--  [500] POST http://localhost:8000/payments/process/stripe/ [evt_3Q0v28EUm7G1T8P41FYyqdPh]
2024-09-19 21:49:18  <--  [500] POST http://localhost:8000/payments/process/stripe/ [evt_3Q0v28EUm7G1T8P413Bt8fVq]
2024-09-19 21:49:18   --> payment_intent.created [evt_3Q0v28EUm7G1T8P41LTjOiDR]
2024-09-19 21:49:18  <--  [500] POST http://localhost:8000/payments/process/stripe/ [evt_3Q0v28EUm7G1T8P41LTjOiDR]
2024-09-19 21:49:20   --> charge.updated [evt_3Q0v28EUm7G1T8P4168kQUuC]
2024-09-19 21:49:20  <--  [500] POST http://localhost:8000/payments/process/stripe/ [evt_3Q0v28EUm7G1T8P4168kQUuC]
2024-09-19 21:49:24   --> checkout.session.completed [evt_1Q0v2FEUm7G1T8P44kb2hHhC]
2024-09-19 21:49:24  <--  [200] POST http://localhost:8000/payments/process/stripe/ [evt_1Q0v2FEUm7G1T8P44kb2hHhC]

App:

[20/Sep/2024 00:47:10] "POST /payments/process/stripe/ HTTP/1.1" 500 109937
[20/Sep/2024 00:48:54] "GET / HTTP/1.1" 200 3579
[20/Sep/2024 00:48:54] "GET /static/CACHE/js/output.c3aca029a680.js HTTP/1.1" 200 168231
[20/Sep/2024 00:48:54] "GET /static/CACHE/css/output.80b3f02238f7.css HTTP/1.1" 200 315578
[20/Sep/2024 00:48:54] "GET /static/CACHE/js/output.3bb50f9aa3d1.js HTTP/1.1" 200 28971
[20/Sep/2024 00:48:58] "GET /shop/buy/mensal HTTP/1.1" 302 0
Internal Server Error: /payments/process/stripe/
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/payments/stripe/providers.py", line 233, in get_token_from_request
    return event["data"]["object"]["client_reference_id"]
KeyError: 'client_reference_id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/homebrew/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
    return view_func(request, *args, **kwargs)
  File "/opt/homebrew/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/opt/homebrew/lib/python3.10/site-packages/payments/urls.py", line 45, in static_callback
    token = provider.get_token_from_request(request=request, payment=None)
  File "/opt/homebrew/lib/python3.10/site-packages/payments/stripe/providers.py", line 235, in get_token_from_request
    raise PaymentError(
payments.PaymentError: client_reference_id is not present, check Stripe Dashboard.
Internal Server Error: /payments/process/stripe/
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/payments/stripe/providers.py", line 233, in get_token_from_request
    return event["data"]["object"]["client_reference_id"]
KeyError: 'client_reference_id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/homebrew/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
    return view_func(request, *args, **kwargs)
  File "/opt/homebrew/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/opt/homebrew/lib/python3.10/site-packages/payments/urls.py", line 45, in static_callback
    token = provider.get_token_from_request(request=request, payment=None)
  File "/opt/homebrew/lib/python3.10/site-packages/payments/stripe/providers.py", line 235, in get_token_from_request
    raise PaymentError(
payments.PaymentError: client_reference_id is not present, check Stripe Dashboard.
[20/Sep/2024 00:49:18] "POST /payments/process/stripe/ HTTP/1.1" 500 106133
[20/Sep/2024 00:49:18] "POST /payments/process/stripe/ HTTP/1.1" 500 109857
Internal Server Error: /payments/process/stripe/
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/payments/stripe/providers.py", line 233, in get_token_from_request
    return event["data"]["object"]["client_reference_id"]
KeyError: 'client_reference_id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/homebrew/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
    return view_func(request, *args, **kwargs)
  File "/opt/homebrew/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/opt/homebrew/lib/python3.10/site-packages/payments/urls.py", line 45, in static_callback
    token = provider.get_token_from_request(request=request, payment=None)
  File "/opt/homebrew/lib/python3.10/site-packages/payments/stripe/providers.py", line 235, in get_token_from_request
    raise PaymentError(
payments.PaymentError: client_reference_id is not present, check Stripe Dashboard.
[20/Sep/2024 00:49:18] "POST /payments/process/stripe/ HTTP/1.1" 500 106013
Internal Server Error: /payments/process/stripe/
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/payments/stripe/providers.py", line 233, in get_token_from_request
    return event["data"]["object"]["client_reference_id"]
KeyError: 'client_reference_id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/homebrew/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
    return view_func(request, *args, **kwargs)
  File "/opt/homebrew/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/opt/homebrew/lib/python3.10/site-packages/payments/urls.py", line 45, in static_callback
    token = provider.get_token_from_request(request=request, payment=None)
  File "/opt/homebrew/lib/python3.10/site-packages/payments/stripe/providers.py", line 235, in get_token_from_request
    raise PaymentError(
payments.PaymentError: client_reference_id is not present, check Stripe Dashboard.
[20/Sep/2024 00:49:20] "POST /payments/process/stripe/ HTTP/1.1" 500 109857

[20/Sep/2024 00:49:24] "POST /payments/process/stripe/ HTTP/1.1" 200 16

What can be wrong?

mariofix commented 1 month ago

Do you have a GitHub repo to checkout and see your code?

paulocoutinhox commented 1 month ago

Yes, github.com/paulocoutinhox/pyaa

Em qui., 19 de set. de 2024 às 21:59, Mario Hernandez < @.***> escreveu:

Do you have a GitHub repo to checkout and see your code?

— Reply to this email directly, view it on GitHub https://github.com/jazzband/django-payments/issues/424#issuecomment-2362505882, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADAOWBF5P7OAYGLC4O4JR3ZXNXQZAVCNFSM6AAAAABORAABB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRSGUYDKOBYGI . You are receiving this because you authored the thread.Message ID: @.***>