Skip to main content

Python interface to the Securepay payment processor.

Project description

securepay is a Python interface to the Securepay credit card payment gateway.

This module doesn’t yet provide credit card authorisation transactions (ie. putting some money on hold for an upcoming payment).

Quickstart

This package can be used as follows:

from securepay import pay_by_cc, refund, SecurePayError

SECUREPAY_API_URL= 'https://test.securepay.com.au/xmlapi/payment'
SECUREPAY_MERCHANT_ID = '...'
SECUREPAY_PASSWORD = '...'

# Take a credit card payment.
try:
    pay_attempt = pay_by_cc(
        cents, purchase_order_id, cc_number, cc_expiry,
        SECUREPAY_API_URL, SECUREPAY_MERCHANT_ID,
        SECUREPAY_PASSWORD, cc_card_name)
except SecurePayError as err:
    # Give customers a generic error about service being unavailable.

if pay_attempt['approved']:
    # Payment successful!
else:
    # Payment declined. Error message is in pay_attempt['bank_response_text']


# Refund the payment.
try:
    refund_attempt = securepay.refund(
        cents, purchase_order_id, transaction_ref, SECUREPAY_API_URL,
        SECUREPAY_MERCHANT_ID, SECUREPAY_PASSWORD)
except SecurePayError as err:
    # Give staff member a generic error about service being unavailable.

if pay_attempt['approved']:
    # Refund successful!
else:
    # Refund declined. Error message is in pay_attempt['bank_response_text']

TODO

  • remove dependency on pytz

  • make payments live by default

  • display warnings for error code payments against debug

  • add credit authorisation

  • update tests to mock out live gateway public testing account?

  • add detailed logging

  • merge in reconciliation tool

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

securepay-0.3.tar.gz (5.4 kB view hashes)

Uploaded Source

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