Skip to main content

Unlimint APIv3 Python SDK

Project description

Unlimint APIv3 Python SDK

You can sign up for a Unlimint account at https://www.unlimint.com.

Getting Started

Please follow the installation instruction and take a look at usage examples.

Requirements

Python 3+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/cardpay/python-sdk-v3.git --upgrade

or

pip install 'cardpay>=3.48.4' --upgrade

Then import the package:

from cardpay import *

Setuptools

Install via Setuptools.

python setup.py install --user

Then import the package:

from cardpay import *

Usage examples

Example for Auth

import os
from cardpay import *

CARDPAY_API_URL = os.getenv('CARDPAY_API_URL', 'https://sandbox.cardpay.com')
GATEWAY_TERMINAL_CODE = os.getenv('GATEWAY_TERMINAL_CODE', '00000')
GATEWAY_PASSWORD = os.getenv('GATEWAY_PASSWORD', 'password')

auth = AuthApi(ApiClient(baseUrl=CARDPAY_API_URL))

result = auth.obtain_tokens(
    grant_type="password",
    terminal_code=GATEWAY_TERMINAL_CODE,
    password=GATEWAY_PASSWORD
)

access_token = result.access_token
refresh_token = result.refresh_token

print('access_token:',access_token)
print('refresh_token:', refresh_token)

Example for payment

import os
from cardpay import *

CARDPAY_API_URL = os.getenv('CARDPAY_API_URL', 'https://sandbox.cardpay.com')
GATEWAY_TERMINAL_CODE = os.getenv('GATEWAY_TERMINAL_CODE', '00000')
GATEWAY_PASSWORD = os.getenv('GATEWAY_PASSWORD', 'password')

config = Configuration(
    base_url=CARDPAY_API_URL,
    terminal_code=GATEWAY_TERMINAL_CODE,
    password=GATEWAY_PASSWORD
)
payments = PaymentsApi(ApiClient(config))

request = PaymentRequest(
    request=ApiClient.uuid_request(),
    merchant_order=PaymentRequestMerchantOrder(
        id='merchant order id',
        description='merchant description'
    ),
    card_account=PaymentRequestCardAccount(
        card=PaymentRequestCard(
            pan='card pan',
            holder='cardholder in Upper Case',
            expiration='expiration date',
            security_code='123'
        ),
        billing_address = BillingAddress(
            country='USA',
            state='NY',
            zip='10001',
            city='New York',
            addr_line_1='address1',
            addr_line_2='address2'
        )
    ),
    customer=PaymentRequestCustomer(
        id='000',
        full_name='full name',
        birth_date='birth date',
        email='e-mail',
        phone='+###########',
        work_phone='+###########',
        home_phone='+###########',
        locale='en'
    ),
    payment_method="BANKCARD",
    payment_data=PaymentRequestPaymentData(
        currency="currency",
        amount=1.23
    )
)

create_payment_response = payments.create_payment(request)
payment_id = create_payment_response.payment_data.id
redirect_url = create_payment_response.redirect_url

print("payment_id:", payment_id);
print("redirect_url:", redirect_url);

payment_response = payments.get_payment(payment_id)
print('payment_response:', payment_response)
print('payment_status:', payment_response.payment_data.status)

Proxy usage

The SDK will automatically use a proxy if the HTTPS_PROXY or HTTP_PROXY environment variable is set.

If the NO_PROXY env variable is set, the SDK won't use the proxy for hosts from this variable. The format of NO_PROXY: comma separated domain names (e.g. "cardpay.com,.example.com").

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

cardpay-3.48.4.tar.gz (145.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cardpay-3.48.4-py2.py3-none-any.whl (405.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cardpay-3.48.4.tar.gz.

File metadata

  • Download URL: cardpay-3.48.4.tar.gz
  • Upload date:
  • Size: 145.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

File hashes

Hashes for cardpay-3.48.4.tar.gz
Algorithm Hash digest
SHA256 e866741dc17d3a7a9cdf8ff74c64f127808259c800df929235fec7604d90ec60
MD5 df38273f1d87928363dfc0debddac62d
BLAKE2b-256 c354bd0b3fddbe9c49189801d8cb7fb6b20d937f212a687840ac40fb9b572b13

See more details on using hashes here.

File details

Details for the file cardpay-3.48.4-py2.py3-none-any.whl.

File metadata

  • Download URL: cardpay-3.48.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 405.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

File hashes

Hashes for cardpay-3.48.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 61aac30eaae40d03b831c7d52f396930cbebcabd7b692b7a28a3167463352405
MD5 7d8b034a7eb1be38d4a2e5bc657d1599
BLAKE2b-256 18d6f66f72aee01f67b2896b387c8c6940fc3db284376cb9f048f8da5cce5616

See more details on using hashes here.

Supported by

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