mrcartier avatar image
mrcartier asked David Marginian edited

How to get charge response - Python SDK

Trying to use python SDK to create a charge but I'm not sure how the response is returned. In the docs screenshot below

I can create the charge & (I assume) the python SDK posts to it the endpoint but that's it? A sample response is shown but just not clear to me how it's returned...

Sandboxe-commerce api
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I haven't used the python SDK, but from the docs I would assume the "charge" variable contains the response.

0 Likes 0 ·
mrcartier avatar image mrcartier David Marginian ♦♦ ·

Thanks @David Marginian for reply, you're right. As best I can tell from docs we do not need OAuth token when creating a charge with python SDK. But every response I get is 401...

print('in charge token is: ', token,' money: ',amt)
charge = Charge.create(amount=amt,currency='usd',source=token)
print('clover charge ',charge)

In the terminal I keep seeing 'clover charge {'message': '401 Unauthorized'}' which indicates token is invalid. But when I try same token that fails along with an OAuth token like the call found here I get a 200 response (screenshot below)

Do we need to include OAuth token too? It seems the tokens work along with an OAuth token but from docs I can't tell where to include it using the python SDK code block above when creating the charge (charge = Charge.create.....)

0 Likes 0 ·

Have you read the docs here:

You need to get the token for a card before calling charge.

Also, please see the README included in the SDK download.

0 Likes 0 ·
Show more comments

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community