Python
Our simple, straightforward API gets you up and running quickly.
-
1
Install
-
2
Set API Keys
-
3
Try Examples
The Python SDK is registered with the PyPI index and can be installed using pip or easy_install.
Install using pip:
pip install simplifycommerce-sdk-python
Install using easy_install:
easy_install simplifycommerce-sdk-python
Alternatively the package can be documentation.sdk.pythonsdk.install.step8 documentation.sdk.pythonsdk.install.step9:
python setup.py install
Dependencies
The python SDK requires python 3.7
Set your API Keys
After logging into your account, your API keys can be located at: Settings -> API Keys
To set your public and private API keys do the following:
simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"
Another option is to pass the api keys as arguments to each API invocation.
Examples
Charging a card
You can charge a card in 2 ways. Once you have generated a card token using simplify.js, you can charge the card using the token. Alternatively, you can also charge a card by passing the card details.
For more information on the simplify.js go to Payments Form
import simplify
simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"
payment = simplify.Payment.create({
"token" : "f21da65e-f0ab-45cb-b8e6-40b493c3671f",
"amount" : "1000",
"description" : "prod description",
"currency" : "USD"
})
if payment.paymentStatus == 'APPROVED':
print("Payment approved")
import simplify
simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"
payment = simplify.Payment.create({
"card" : {
"number": "5555555555554444",
"expMonth": 11,
"expYear": 99,
"cvc": "123"
},
"amount" : "1000",
"description" : "prod description",
"currency" : "USD"
})
if payment.paymentStatus == 'APPROVED':
print("Payment approved")
For more examples see the api documentation or our tutorial