GiftRocket gift card API for python
Python Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
giftrocket
.gitignore
.travis.yml
LICENSE.txt
Makefile
README.md
requirements.txt
setup.cfg
setup.py

README.md

giftrocket-python

A python client library for the GiftRocket API.

Installation

$ pip install giftrocket-python

Getting started

All API requests require an access token. A sandbox access token is assigned upon signup through the GiftRocket Dashboard. Once you are ready to move to production, you will be assigned a production access token.

Authentication

client = GiftRocket("[YOUR_ACCESS_TOKEN]")

Orders

See API documentation for all Order options. Use the FoundingSources resource to look up a valid method for your payment (i.e. credit card, ACH, etc).

# Create a new order, specifying your gift options
# as an array of objects.
response = client.create_order({
  "funding_source_id": "[FUNDING_SOURCE_ID]",
  "gifts": [
    {
      "amount": 40,
      "message": "Such a great way to show appreciation to others!",
      "recipient": {
        "email": "person@yourteam.com",
        "name": "Person Example"
      },
      "style_id": "thank_you_tree"
    }
  ]
})

if response.ok:
    order = response.to_json()["order"]


# Return historical orders, optionally passing a starting offset for results.
response = client.get_orders({offset: 10})

# Return a order by order_id
response = client.get_order("[ORDER_ID]")

Funding Sources

Production funding sources must be added through the web dashboard. A sandbox funding source is provided during development.

# Retrieve a list of your funding sources (credit card, ach, etc).
response = client.get_funding_sources()

Styles

A style defines the presentation of your gift. The styles endpoint returns an array of card designs.

response = client.get_styles()

Gifts

Retrieve a single or many historical gifts sent by your account.

response = client.get_gifts({offset: 10})

response = client.get_gift("[GIFT_ID]")