Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

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

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

from giftrocket import GiftRocket

# Sandbox environment
client = GiftRocket("[SANDBOX_ACCESS_TOKEN]", "https://testflight.giftrocket.com")

# Production environment
client = GiftRocket("[PRODUCTION_ACCESS_TOKEN]", "https://www.giftrocket.com")

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": "[STYLE_ID]"
    }
  ]
})

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]")

About

GiftRocket gift card API for python

Resources

License

Packages

No packages published