Skip to content

Got an unexpected keyword argument 'total_price_cents_usd' to method create_order #23

@jkelso662

Description

@jkelso662

Hi there.

I received the following error when using the example python code from docs. I am using the test API keys as the 'ApiClient' and have been able to create orders sucessfully by mass_g. However, when using the create order by price, I am receiving argument errors.

total_price_cents_usd = 500 # Pass in the total price in cents of US dollars (i.e. 5 dollars)
patch.orders.create_order(total_price_cents_usd=total_price_cents_usd)

Results in

ApiTypeError: Got an unexpected keyword argument 'total_price_cents_usd' to method create_order

On looking at the orders_api.py I see there is no total_price_cents_usd, just price_cents_usd. Changing the param label to this results in the following error.

total_price_cents_usd = 500 # Pass in the total price in cents of US dollars (i.e. 5 dollars)
patch.orders.create_order(price_cents_usd=total_price_cents_usd)

Results in...

ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Server': 'nginx/1.17.8', 'Date': 'Tue, 30 Mar 2021 09:57:35 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'X-Download-Options': 'noopen', 'X-Permitted-Cross-Domain-Policies': 'none', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'Vary': 'Accept, Origin', 'Cache-Control': 'no-cache', 'X-Request-Id': '961cb0a64cba5d3835a9b28336dd3455', 'X-Runtime': '0.026914', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, PATCH, OPTIONS', 'Access-Control-Allow-Headers': 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'})
HTTP response body: {"data":null,"error":{"code":422,"message":" must only contain one of: mass_g, total_price_cents_usd"},"meta":null,"success":false}

Thanks in advance.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions