Skip to content

Voucherify Python SDK | Use cases: online coupons, prepaid vouchers, in-app promo codes

License

Notifications You must be signed in to change notification settings

team-blaze/voucherify-python-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Official Voucherify SDK for Python

Setup | Contributing | Changelog

API: Vouchers | Distributions | Redemptions | Customers | Utils


Setup

pip install 'Voucherify'

Log-in to Voucherify web interface and obtain your Application Keys from Configuration:

from voucherify import Client as voucherifyClient

client = voucherifyClient(
    application_id='YOUR-APPLICATION-ID',
    client_secret_key='YOUR-CLIENT-SECRET-KEY'
)

API Endpoint

Optionally, you can add api_endpoint to the client options if you want to use Voucherify running in a specific region.

from voucherify import Client as voucherifyClient

client = voucherifyClient(
    application_id='YOUR-APPLICATION-ID',
    client_secret_key='YOUR-CLIENT-SECRET-KEY',
    api_endpoint='https://<region>.api.voucherify.io'
)

API

This SDK is consistent with restful API Voucherify provides. Not all API methods are currently supported in this SDK, but they are coming soon.

You will find detailed description and example responses at official docs. Method headers point to more detailed descriptions of params you can use.

Vouchers API

Methods are provided within client.vouchers.* namespace.

client.vouchers.create(voucher)

Check voucher object.

client.vouchers.get(code)
client.vouchers.update(voucher)
client.vouchers.list(params)
client.vouchers.enable(code)
client.vouchers.disable(code)

Distributions API

Methods are provided within client.distributions.* namespace.

client.distributions.publish(params)

Redemptions API

Methods are provided within client.redemptions.* namespace.

client.redemptions.redeem(code, tracking_id)
client.redemptions.list(params)
client.redemptions.getForVoucher(code)
client.redemptions.rollback(redemptionId)
client.redemptions.rollback(redemptionId, reason)

Check redemption rollback object.


Customers API

Methods are provided within client.customers.* namespace.

client.customers.create(customer)

Check customer object.

client.customers.get(customerId)

customer object must contain id or source_id.

client.customers.update(customer)
client.customers.delete(customerId)

Utils

from voucherify import utils

Available methods

  • utils.calculate_price(base_price, voucher, unit_price)
  • utils.calculate_discount(base_price, voucher, unit_price)

Contributing

Bug reports and pull requests are welcome through GitHub Issues.

Changelog

  • 2019-06-19 - 2.1.0 Added support for custom API endpoint, that allows to connect to projects created in specific Voucherify region.
  • 2018-01-20 - 2.0.0
    • Moved vouchers related methods to client.vouchers.* namespace
    • Moved redemptions related methods to client.redemptions.* namespace
    • Moved distributions related methods to client.distributions.* namespace
    • Renamed client.customer.* to client.customers.*
    • Removed outdated client.distributions.publish(campaignName) method interface
    • Fixed utils methods to accept vouchers with None gift
  • 2016-12-02 - 1.4.2 - Support gift vouchers in utils
  • 2016-10-04 - 1.4.1 - Publish update
  • 2016-07-18 - 1.4.0 - Voucher code pattern
  • 2016-07-18 - 1.3.0 - Update voucher
  • 2016-06-23 - 1.2.1 - Gift vouchers
  • 2016-06-16 - 1.2.0 - Unified naming convention
  • 2016-06-16 - 1.1.0 - Added customer methods
  • 2016-06-08 - 1.0.0 - Release version
  • 2016-05-31 - 0.1.0 - First version:
    • Authentication
    • Voucher informations: get, usage
    • Voucher operations: use
    • Utils

About

Voucherify Python SDK | Use cases: online coupons, prepaid vouchers, in-app promo codes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.8%
  • Makefile 0.2%