Invalid string: { "addre...d": null }; must be at most 500 characters

Submitted 4 years, 10 months ago
Ticket #23
Views 406
Language/Framework Django
Priority Low
Status Closed

Getting bellow error

InvalidRequestError at /cart/checkout/

Request req_SMZSaDduY9pgEX: Invalid string: {
  "addre...d": null
}; must be at most 500 characters

Request Method:POSTRequest URL:http://127.0.0.1:8000/cart/checkout/Django Version:3.0.6Exception Type:InvalidRequestErrorException Value:

Request req_SMZSaDduY9pgEX: Invalid string: {
  "addre...d": null
}; must be at most 500 characters

Exception Location:C:\Users\Mahesh\himalaya\lib\site-packages\stripe\api_requestor.py in handle_error_response, line 152Python Executable:C:\Users\Mahesh\himalaya\Scripts\python.exePython Version:3.7.4Python Path:

['C:\\Users\\Mahesh\\himalaya\\ecommerce',
 'C:\\Users\\Mahesh\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip',
 'C:\\Users\\Mahesh\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs',
 'C:\\Users\\Mahesh\\AppData\\Local\\Programs\\Python\\Python37-32\\lib',
 'C:\\Users\\Mahesh\\AppData\\Local\\Programs\\Python\\Python37-32',
 'C:\\Users\\Mahesh\\himalaya',
 'C:\\Users\\Mahesh\\himalaya\\lib\\site-packages']

models.py

https://www.ppaste.org/RWxUncmar

views.py

https://www.ppaste.org/zQ8zBS7ui

please help

Submitted on Jun 16, 20
add a comment

1 Answer

Acknowledged.

Submitted 4 years, 10 months ago

In future, please use the code formatter while you submit the ticket. Its easy for us to get the code here rather than jumping here and there

- sunil 4 years, 10 months ago

sure sir...

- maheshbist111 4 years, 10 months ago

can you show ur urls.py and provide more details?.. about which view function you are getting an error?

- sunil 4 years, 10 months ago

https://www.ppaste.org/eZj6Dsoyf

- maheshbist111 4 years, 10 months ago

share the code here.

- sunil 4 years, 10 months ago

Python Programming Language - Code Sharing Service PPaste.Org NoteBooks Img2Code b SignUp LogIn AboUt

@Anonymous, 17 Jun 2020, 5:01 a.m. "stripe", Python Fork CodePaste Save to Legacy https://www.ppaste.org/eZj6Dsoyf Copy to Clipboard 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 """ecommerce URL Configuration

The urlpatterns list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf import settings from django.conf.urls.static import static from django.conf.urls import url, include from django.contrib import admin from django.contrib.auth.views import LogoutView from django.urls import path from django.views.generic import TemplateView, RedirectView

from accounts.views import LoginView, RegisterForm, guest_register_view from addresses.views import checkout_address_create_view, checkout_address_reuse_view from billing.views import payment_method_view, payment_method_createview from carts.views import cart_detail_api_view from .views import home_page, about_page, contact_page from marketing.views import MarketingPreferenceUpdateView, MailchimpWebhookView from .forms import Contactform

urlpatterns = [ path('', home_page, name='home'), path('about/', about_page, name='about'), path('accounts/', RedirectView.as_view(url='/account')), path('account/', include(('accounts.urls', 'carts'), namespace='account')), path('contact/', contact_page, name='contact'), path('login/', LoginView.as_view(), name='login'), path('checkout/address/create/', checkout_address_create_view, name='checkout_address_create'), path('checkout/address/reuse/', checkout_address_reuse_view, name='checkout_address_reuse'), path('register/guest', guest_register_view, name='guest_register'), path('logout/', LogoutView.as_view(), name='logout'), path('api/cart/', cart_detail_api_view, name='api-cart'), path('cart/', include(('carts.urls', 'carts'), namespace='cart')), path('billing/payment-method/', payment_method_view, name='billing-payment-method'), path('billing/payment-method/create/', payment_method_createview, name='billing-payment-method-endpoint'), path('register/', RegisterForm.as_view(), name='register'), path('bootstrap/', TemplateView.as_view(template_name='bootstrap/example.html')), path('products/',include(('products.url', 'products'), namespace='products')), path('search/', include(('search.url', 'search'), namespace='search')), path('settings/', RedirectView.as_view(url='/account')), path('settings/email/', MarketingPreferenceUpdateView.as_view(), name='marketing-pref'), path('webhooks/mailchimp/', MailchimpWebhookView.as_view(), name='webhooks_mailchimp'), path('admin/', admin.site.urls),

]

if settings.DEBUG: urlpatterns = urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) app_name='products'

Reply

2019 - 2020 | PPL Facebook 2020

- maheshbist111 4 years, 10 months ago

"""ecommerce URL Configuration

The urlpatterns list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf import settings from django.conf.urls.static import static from django.conf.urls import url, include from django.contrib import admin from django.contrib.auth.views import LogoutView from django.urls import path from django.views.generic import TemplateView, RedirectView

from accounts.views import LoginView, RegisterForm, guest_register_view from addresses.views import checkout_address_create_view, checkout_address_reuse_view from billing.views import payment_method_view, payment_method_createview from carts.views import cart_detail_api_view from .views import home_page, about_page, contact_page from marketing.views import MarketingPreferenceUpdateView, MailchimpWebhookView from .forms import Contactform

urlpatterns = [ path('', home_page, name='home'), path('about/', about_page, name='about'), path('accounts/', RedirectView.as_view(url='/account')), path('account/', include(('accounts.urls', 'carts'), namespace='account')), path('contact/', contact_page, name='contact'), path('login/', LoginView.as_view(), name='login'), path('checkout/address/create/', checkout_address_create_view, name='checkout_address_create'), path('checkout/address/reuse/', checkout_address_reuse_view, name='checkout_address_reuse'), path('register/guest', guest_register_view, name='guest_register'), path('logout/', LogoutView.as_view(), name='logout'), path('api/cart/', cart_detail_api_view, name='api-cart'), path('cart/', include(('carts.urls', 'carts'), namespace='cart')), path('billing/payment-method/', payment_method_view, name='billing-payment-method'), path('billing/payment-method/create/', payment_method_createview, name='billing-payment-method-endpoint'), path('register/', RegisterForm.as_view(), name='register'), path('bootstrap/', TemplateView.as_view(template_name='bootstrap/example.html')), path('products/',include(('products.url', 'products'), namespace='products')), path('search/', include(('search.url', 'search'), namespace='search')), path('settings/', RedirectView.as_view(url='/account')), path('settings/email/', MarketingPreferenceUpdateView.as_view(), name='marketing-pref'), path('webhooks/mailchimp/', MailchimpWebhookView.as_view(), name='webhooks_mailchimp'), path('admin/', admin.site.urls),

]

if settings.DEBUG: urlpatterns = urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) app_name='products'

- maheshbist111 4 years, 10 months ago

"""ecommerce URL Configuration The urlpatterns list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf import settings from django.conf.urls.static import static from django.conf.urls import url, include from django.contrib import admin from django.contrib.auth.views import LogoutView from django.urls import path from django.views.generic import TemplateView, RedirectView from accounts.views import LoginView, RegisterForm, guest_register_view from addresses.views import checkout_address_create_view, checkout_address_reuse_view from billing.views import payment_method_view, payment_method_createview from carts.views import cart_detail_api_view from .views import home_page, about_page, contact_page from marketing.views import MarketingPreferenceUpdateView, MailchimpWebhookView from .forms import Contactform urlpatterns = [ path('', home_page, name='home'), path('about/', about_page, name='about'), path('accounts/', RedirectView.as_view(url='/account')), path('account/', include(('accounts.urls', 'carts'), namespace='account')), path('contact/', contact_page, name='contact'), path('login/', LoginView.as_view(), name='login'), path('checkout/address/create/', checkout_address_create_view, name='checkout_address_create'), path('checkout/address/reuse/', checkout_address_reuse_view, name='checkout_address_reuse'), path('register/guest', guest_register_view, name='guest_register'), path('logout/', LogoutView.as_view(), name='logout'), path('api/cart/', cart_detail_api_view, name='api-cart'), path('cart/', include(('carts.urls', 'carts'), namespace='cart')), path('billing/payment-method/', payment_method_view, name='billing-payment-method'), path('billing/payment-method/create/', payment_method_createview, name='billing-payment-method-endpoint'), path('register/', RegisterForm.as_view(), name='register'), path('bootstrap/', TemplateView.as_view(template_name='bootstrap/example.html')), path('products/',include(('products.url', 'products'), namespace='products')), path('search/', include(('search.url', 'search'), namespace='search')), path('settings/', RedirectView.as_view(url='/account')), path('settings/email/', MarketingPreferenceUpdateView.as_view(), name='marketing-pref'), path('webhooks/mailchimp/', MailchimpWebhookView.as_view(), name='webhooks_mailchimp'), path('admin/', admin.site.urls), ] if settings.DEBUG: urlpatterns = urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) app_name='products'

- maheshbist111 4 years, 10 months ago

I use code formater still paste in same way

- maheshbist111 4 years, 10 months ago

https://dpaste.org/JX78

- maheshbist111 4 years, 10 months ago

this is the main url path('cart/', include(('carts.urls', 'carts'), namespace='cart')),. Can you also show me the cart url and what view this URL calling. Also what the errror you are getting?. Because your description is very confusing

- sunil 4 years, 10 months ago

its should redirect to carts/checkout-done.html getting error is Invalid string: { "addre...d": null }; must be at most 500 characters

- maheshbist111 4 years, 10 months ago

its should redirect to carts/checkout-done.html getting error is Invalid string: { "addre...d": null }; must be at most 500 characters

- maheshbist111 4 years, 10 months ago

its should redirect to carts/checkout-done.html getting error is Invalid string: { "addre...d": null }; must be at most 500 characters

- maheshbist111 4 years, 10 months ago

its should redirect to carts/checkout-done.html getting error is Invalid string: { "addre...d": null }; must be at most 500 characters

- maheshbist111 4 years, 10 months ago

Still I didnt understand the logic and requirement. May be try this https://github.com/stripe/stripe-php/issues/246 . Seems like some how your stripe key is not accepting the string values for 500 characters. I need below things in order to help you, "1. Cart URL.py file"
"2. which view using this /cart/checkout/ to perform the logic"
"3. Html code for this page"

- sunil 4 years, 10 months ago

this is my cart url.py https://www.ppaste.org/CQZWBjXlb

- maheshbist111 4 years, 10 months ago

html file https://www.ppaste.org/uAmGakvqt

- maheshbist111 4 years, 10 months ago

view.py https://www.ppaste.org/ZhBTtYvVc

- maheshbist111 4 years, 10 months ago

InvalidRequestError at /cart/checkout/ Request req_BLqZ6Hcawx8Thh: Invalid string: { "addre...d": null }; must be at most 500 characters Request Method: POST Request URL: http://127.0.0.1:8000/cart/checkout/

- maheshbist111 4 years, 10 months ago

I get error whin I submit for checkout... it should redirect for checkout-done.html page....

- maheshbist111 4 years, 10 months ago

can we connect at 9.45 PM PST?

- sunil 4 years, 10 months ago

sure... is it Indian time

- maheshbist111 4 years, 10 months ago

May be we can connect tommorrow. How about tomorrow 10 AM IST.?

- sunil 4 years, 10 months ago

that's more convenient sir... surely

- maheshbist111 4 years, 10 months ago

Scheduled the meeting and sent you the invite. Lets connect. As you can always support here Donate

- sunil 4 years, 10 months ago

It looks like issue in STRIPE API call . Please double check the stripe API document

- sunil 4 years, 10 months ago

As we dont get any update on this. We are closing the ticket.

- bhavana 4 years, 10 months ago

I had given access to Mr Sunil yesterday but due to network issue it got disconnected..letter I could not able to reach him...

- maheshbist111 4 years, 10 months ago

Sorry to hear. I had a discussion with Sunil. Seems like its issue in billing profile app which is connected to stripe, so he suggested to debug the BILLING Profile app step by step. In case if you struggle please raise the new ticket.

- bhavana 4 years, 10 months ago


Latest Blogs