This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

ThePay

Library for accesing ThePay payment gateway from python

Example

Configure ThePay account

from thepay.config import Config
config = Config()
config.setCredentials(12345, 12345, 'abcdefg12345', 'abcdefg12345')  # Credentials from ThePay account settings

List available payment methods

from thepay.dataApi import DataApi
data_api = DataApi(config)
payments = data_api.getPaymentMethods()

print methods as radio buttons with images

<div>
    {% for payment in payments %}
     <div class="payment-method">
        <input type="radio" name="payment_method" value="{{ payment.id }}" id="payment_{{ payment.id }}">
        <label for="payment_{{ payment.id }}" title="{{ payment.name }}">
           <img src='http://www.thepay.cz/gate/images/logos/public/209x127/{{ payment.id }}.png' alt="{{ payment.name }}">
        </label>
     </div>
    {% endfor %}
</div>

Redirect user to ThePay - create payment

from thepay.payment import Payment

payment = Payment(config)

payment.setValue(321)
payment.setMethodId(13) # ID of payment method from above
payment.setCustomerEmail('test@test.te)
payment.setDescription('Order 123 payment')
payment.setReturnUrl('https://example.com/payment')  # where to redirect user after payment
payment.setMerchantData(123)  # Any custom data - not visible to user

payment.getCreateUrl()  # Redirect user to this URL to begin payment

Check incomming payment

This code should be run on returnUrl from above code

return_payment = ReturnPayment(config)
return_payment.parseData(self.request.GET)  # Pass all GET received data in form of dict()

if not return_payment.checkSignature():
    return False  # Invalid payment signature

return_payment.getMerchantData()  # -> 123, previously saved custom data
return_payment.getValue()  # -> 321
return_payment.getStatus()  # Order status, see next paragraph
Order statuses
  • 2 = STATUS_OK
  • 3 = STATUS_CANCELED
  • 4 = STATUS_ERROR
  • 6 = STATUS_UNDERPAID
  • 7 = STATUS_WAITING
  • 9 = STATUS_CARD_DEPOSIT

Get info about payment

payment_id = return_payment.getPaymentId()
payment = data_api.getPayment(payment_id)  # returns object with all payment data

License

LGPL

Release History

Release History

0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
thepay-0.2.tar.gz (5.5 kB) Copy SHA256 Checksum SHA256 Source Sep 26, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting