Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4073

How to implement Stripe PaymentMethod in a REST API

$
0
0

I am trying to integrate Stripe in my REST API using python. The client API call will provide the credit card info, address etc. I am using the below code create the PaymentMethod using the stripe test API Key.

async def my_payment_method():    payment_method = stripe.PaymentMethod.create(        type="card",        card={"number":"4242 4242 4242 4242","exp_month": 12,"exp_year": 2027,"cvc": 123        }      ) 

The above code is throwing an exception,

Sending credit card numbers directly to the Stripe API is generally unsafe. We suggest you use test tokens that map to the test card you are using

I also tried to create the token using the below, but got the same error message as above

stripe.Token.create(    card={"number": "4242424242424242","exp_month": "5","exp_year": "2028","cvc": "314",         },   )

Thanks for helping to test the stripe API call.


Viewing all articles
Browse latest Browse all 4073

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>