The Smartpay Python SDK offers easy access to Smartpay API from applications written in Python.
Python v3+
pip install --save smartpayThe package needs to be configured with your own API keys, you can find them on your dashboard.
fromsmartpayimportSmartpaysmartpay=Smartpay('<YOUR_SECRET_KEY>', public_key='<YOUR_PUBLIC_KEY>');If you would like to know how Smartpay payment works, please see the payment flow for more details.
payload= {
items: [
{
name: "レブロン 18 LOW",
amount: 250,
currency: "JPY",
quantity: 1,
},
],
shipping: {
line1: "line1",
locality: "locality",
postalCode: "123",
country: "JP",
},
# Your internal reference of the orderreference: "order_ref_1234567",
# Callback URLssuccessUrl: "https://docs.smartpay.co/example-pages/checkout-successful",
cancelUrl: "https://docs.smartpay.co/example-pages/checkout-canceled",
test: true,
};
session=smartpay.create_checkout_session(payload);sessionURL=smartpay.get_session_url(session);We also prepare a more real-world example for you to refer to.