Python API for integrating with the Red Shepherd Payouts
Project description
Red Shepherd Python Payout API Docs
Follow these steps for Simple API Integration
Step 1 a- Adding the payout library using pip
Add the payout library to your code using pip
> pip install payout
Step 1 b - Create a Payout object for secure API methods
Create a payout API object which lets you access all the payout functions
from payout import Payout
### REPLACE app and key with your PROD keys and use a valid account
### These are DEMO Keys which you can safely use for testing
app = "DEMO";
key = "MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAtsQxNp3vmKVNYIxfWSi0LIRgCnPaMn0MUNouxgrs4zmg4cnvSeQ3I8YP03YbpXuWA80RvOw/nWErYAKomniJw8Y+xexMfBQ5sgJgewn3ZnRPNM9Y4Z62gwfIlsrs7Bwvpz9uUtLgeQLl1ffNaumnu1IBrqRps0EZ1QyDuu41UckTyo31C40Wez6IbeMfZeusrmPlIWqyBacdviJ5zHCA3zHNq86QMnB8HOP1U81HOSs6GTTelhD7lCoJ+fHKHxcz0MDr37fNpKpC57B0/20wBXFp9tlVtSkHcIty1lyNk2/HDH8knCdqkZk+fCvWgGwdex41x8/rM+LKC13c5J/yG6Gb2PnKhwNk4lvvnz73YAdqTUJ7qNrdtWVnOTWfbMBiNlpBCVqt8xY8UK6u83AVWrWXse0xe2Pn/kRqlXmxWT0mGEoCavjvZ9lQUL7LXAXZ1dff9r+oFUZo6xDQ3ER/OTIKa4jpvaI9S/J1drsrI1f9kkMWFwEh48dCPYplGSxzAgMBAAE=";
### Use this payout object for all the API calls
payout = Payout(app, key)
API Functions
Create a Payout Account
Create a new Payout Account in the system which will later be configure to receive payouts from the Red Shepherd payout scheduler
id should be unique identifier for each Payout Account rest of the request fields are self explanatory
import json
request = {
"id": "PZZA",
"name": "Pizza Pizza",
"website": "www.pizzapizza.com",
"address1": "123 Main Street",
"address2": "Suite 2001",
"city": "Chicago",
"state": "IL",
"zip": "60004",
"country": "US",
"contactName": "John Smith",
"contactPhone": "312-899-8999",
"contactEmail": "john@pizzapizza.com",
"status": "A"
}
print("CREATE PAYOUT ACCOUNT request >>>")
print(json.dumps(request, indent=2))
response = payout.CreatePayoutAccount(request)
print("CREATE PAYOUT ACCOUNT response >>>")
print(json.dumps(response, indent=2))
CreatePayoutAccount Request Example
{
"id": "PZZA",
"name": "Pizza Pizza",
"website": "www.pizzapizza.com",
"address1": "123 Main Street",
"address2": "Suite 2001",
"city": "Chicago",
"state": "IL",
"zip": "60004",
"country": "US",
"contactName": "John Smith",
"contactPhone": "312-899-8999",
"contactEmail": "john@pizzapizza.com",
"status": "A"
}
CreatePayoutAccount Response
{
"id": "PZZA",
"app": "DEMO",
"logoUrl": null,
"name": "Pizza Pizza",
"address1": "123 Main Street",
"address2": "Suite 2001",
"city": "Chicago",
"state": "IL",
"zip": "60004",
"country": "US",
"contactName": "John Smith",
"contactPhone": "312-899-8999",
"contactEmail": "john@pizzapizza.com",
"website": "www.pizzapizza.com",
"status": "A"
}
Update a Payout Account
Update an existing Payout Account in the system_
id should be the unique identifier for an existing Payout Account rest of the request fields are self explanatory
import json
request = {
"id": "PZZA",
"name": "Johns Pizza Inc.",
"website": "www.pizzapizza.com",
"address1": "123 Main Street",
"address2": "Suite 2001",
"city": "Chicago",
"state": "IL",
"zip": "60004",
"country": "US",
"contactName": "John Smith",
"contactPhone": "312-899-8999",
"contactEmail": "john@pizzapizza.com",
"status": "A"
}
print("UPDATE PAYOUT ACCOUNT request >>>")
print(json.dumps(request, indent=2))
response = payout.UpdatePayoutAccount(request)
print("UPDATE PAYOUT ACCOUNT response >>>")
print(json.dumps(response, indent=2))
UpdatePayoutAccount Request Example
{
"id": "PZZA",
"name": "Johns Pizza Inc.",
"website": "www.pizzapizza.com",
"address1": "123 Main Street",
"address2": "Suite 2001",
"city": "Chicago",
"state": "IL",
"zip": "60004",
"country": "US",
"contactName": "John Smith",
"contactPhone": "312-899-8999",
"contactEmail": "john@pizzapizza.com",
"status": "A"
}
UpdatePayoutAccount Response
{
"id": "PZZA",
"app": "DEMO",
"logoUrl": null,
"name": "Johns Pizza Inc.",
"address1": "123 Main Street",
"address2": "Suite 2001",
"city": "Chicago",
"state": "IL",
"zip": "60004",
"country": "US",
"contactName": "John Smith",
"contactPhone": "312-899-8999",
"contactEmail": "john@pizzapizza.com",
"website": "www.pizzapizza.com",
"status": "A"
}
Find a Payout Account by Id
Get an existing Payout Account in the system_
id should be the unique identifier for an existing Payout Account rest of the request fields are self explanatory
import json
request = {
"id": "PZZA",
}
print("FIND PAYOUT ACCOUNT request >>>")
print(json.dumps(request, indent=2))
response = payout.FindPayoutAccount(request)
print("FIND PAYOUT ACCOUNT response >>>")
print(json.dumps(response, indent=2))
FindPayoutAccount Request Example
{
"id": "PZZA",
}
FindPayoutAccount Response
{
"id": "PZZA",
"app": "DEMO",
"logoUrl": null,
"name": "Johns Pizza Inc.",
"address1": "123 Main Street",
"address2": "Suite 2001",
"city": "Chicago",
"state": "IL",
"zip": "60004",
"country": "US",
"contactName": "John Smith",
"contactPhone": "312-899-8999",
"contactEmail": "john@pizzapizza.com",
"website": "www.pizzapizza.com",
"status": "A"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.