Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

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.

Create Voucher

client.vouchers.create(voucher)

Check voucher object.

Get Voucher

client.vouchers.get(code)

Update Voucher

client.vouchers.update(voucher)

List Vouchers

client.vouchers.list(params)

Enable Voucher

client.vouchers.enable(code)

Disable Voucher

client.vouchers.disable(code)

Distributions API

Methods are provided within client.distributions.* namespace.

Publish Voucher

client.distributions.publish(params)

Redemptions API

Methods are provided within client.redemptions.* namespace.

Redeem Voucher

client.redemptions.redeem(code, tracking_id)

List Redemptions

client.redemptions.list(params)

Get Voucher's Redemptions

client.redemptions.getForVoucher(code)

Rollback Redemption

client.redemptions.rollback(redemptionId)
client.redemptions.rollback(redemptionId, reason)

Check redemption rollback object.


Customers API

Methods are provided within client.customers.* namespace.

Create Customer

client.customers.create(customer)

Check customer object.

Get Customer

client.customers.get(customerId)

Update Customer

customer object must contain id or source_id.

client.customers.update(customer)

Delete 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

Topics

Resources

License

Packages

No packages published
You can’t perform that action at this time.