Skip to main content

Smartpay SDK Python

Project description

Smartpay Python SDK

The Smartpay Python SDK offers easy access to Smartpay API from applications written in Python.

Prerequisites

Python v3+

Installation

pip install --save smartpay

Usage

The package needs to be configured with your own API keys, you can find them on your dashboard.

from smartpay import Smartpay

smartpay = 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.

Create Checkout session

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 order
  reference: "order_ref_1234567",

  # Callback URLs
  successURL: "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);

To retreive the session URL

sessionURL = smartpay.get_session_url(session);

We also prepare a more real-world example for you to refer to.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smartpay-0.1.9.tar.gz (7.1 kB view hashes)

Uploaded Source

Built Distribution

smartpay-0.1.9-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page