Package: payout
Red Shepherd Python Payout API DocsTo Make Payouts Work, you need to do the following stepsStep 1. Create a Payout Account, ie the 3rd party you need to pay the funds to.Step 2. Create an ACH token usingredpayAPI for their ACH bank info (routing number and account number)Step 3. Add this token to their accountStep 4. Add a Payout Rate to their account which determines the parameters and frequency of their payoutsStep 5. Do not forget to Start Payouts on that account, otherwise the scheduler will not pick this account for payout schedulingAll these API Calls and steps are included in this documentation, if you have any questions please emailsupport@redshepherd.comFollow these steps for Simple API IntegrationStep 1 a- Adding the payout library using pipAdd the payout library to your code using pip>pipinstallpayoutStep 1 b - Create a Payout object for secure API methodsCreate a payout API object which lets you access all the payout functionsfrompayoutimportPayout### REPLACE app and key with your PROD keys and use a valid account### These are DEMO Keys which you can safely use for testingapp="DEMO";key="MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAtsQxNp3vmKVNYIxfWSi0LIRgCnPaMn0MUNouxgrs4zmg4cnvSeQ3I8YP03YbpXuWA80RvOw/nWErYAKomniJw8Y+xexMfBQ5sgJgewn3ZnRPNM9Y4Z62gwfIlsrs7Bwvpz9uUtLgeQLl1ffNaumnu1IBrqRps0EZ1QyDuu41UckTyo31C40Wez6IbeMfZeusrmPlIWqyBacdviJ5zHCA3zHNq86QMnB8HOP1U81HOSs6GTTelhD7lCoJ+fHKHxcz0MDr37fNpKpC57B0/20wBXFp9tlVtSkHcIty1lyNk2/HDH8knCdqkZk+fCvWgGwdex41x8/rM+LKC13c5J/yG6Gb2PnKhwNk4lvvnz73YAdqTUJ7qNrdtWVnOTWfbMBiNlpBCVqt8xY8UK6u83AVWrWXse0xe2Pn/kRqlXmxWT0mGEoCavjvZ9lQUL7LXAXZ1dff9r+oFUZo6xDQ3ER/OTIKa4jpvaI9S/J1drsrI1f9kkMWFwEh48dCPYplGSxzAgMBAAE=";### Use this payout object for all the API callspayout=Payout(app,key)Payout Account API FunctionsCreate a Payout AccountCreate a new Payout Account in the system which will later be configure to receive payouts from the Red Shepherd payout schedulerid should be unique identifier for each Payout Accountrest of the request fields are self explanatoryimportjsonrequest={"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 AccountUpdate an existing Payout Account in the systemid should be the unique identifier for an existing Payout Accountrest of the request fields are self explanatoryimportjsonrequest={"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 IdGet an existing Payout Account in the systemid should be the unique identifier for an existing Payout Accountrest of the request fields are self explanatoryimportjsonrequest={"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"}Payout Token API FunctionsUsing RedPay API Create a new Token for an ACH Account in the system which will later be configure to receive payouts from the Red Shepherd payout schedulerTo Create an ACH token use the Redpay API Tokenize ACH Account method follow this documentationLibrary is hosted on pypihttps://pypi.org/project/redpay/Once the Token is created for the account for the Receiving party, you can then add it to the Payout Account using the following Payout API CallsAdd a Payout Token to an Existing Payout AccountAdd a ACH Payment token which was tokenized using the redpay api to attach it to an existing Payout Accountid should be unique identifier for each Payout Accounttoken is the ACH Account token for PZZA Account where they would like to get their deposits for their payoutsnote that if the payout account ACH information needs to be updated, just follow the same steps and add a new token to the same accountimportjsonrequest={"id":"PZZA","token":"fojid27g24u57zp1"}print("ADD PAYOUT TOKEN request >>>")print(json.dumps(request,indent=2))response=payout.AddPayoutToken(request)print("ADD PAYOUT TOKEN response >>>")print(json.dumps(response,indent=2))AddPayoutToken Request Example{"id":"PZZA","token":"fojid27g24u57zp1"}AddPayoutToken Response{"id":"DEMO.PZZA.3","app":"DEMO","account":"PZZA","version":3,"token":"fojid27g24u57zp1","timestamp":"2021-03-02T22:49:52.4505780Z","userId":null}Payout Rate API FunctionsAdd a Payout Rate to an existing Payout AccountPayout Rates control the amounts/ frequencies and other parameters for controlling the payout for each Payout AccountAdd a Payout Rate to an Existing Payout Accountid - unique identifier for each Payout AccounttrxPct - how much percent of each transaction should be given to the payout accounttrxFee - flat fee in cents for each transaction to be given to the payout accountmonthlyFee - monthly fee to be paid to the payout account, will be paid on monthlyPayDate day of the monthmonthlyPayDate - date on which the monthly fee is to be paid, (defaults to 1 if not set)yearlyFee - yearly fee to be paid to the payout account, will be paid on yearlyPayMonth month of the yearyearlyPayMonth - month which the monthly fee is to be paid, (defaults to 1 (January) if not set)payFrequency - payment frequency for transaction based payments,D - Daily
W - Weekly
M - MonthlystartDate - payout start date (optional)endDate - payout end date (optional)autoApproveLimit - anything under this limit is automatically paid, if you set this then any payout over this limit will go to review firstimportjsonrequest={"id":"PZZA",# give payout account 80% of each transaction"trxPct":80,# give payout account 1 dollar (100 cents) flat fee per transaction"trxFee":100}print("ADD PAYOUT RATE request >>>")print(json.dumps(request,indent=2))response=payout.AddPayoutRate(request)print("ADD PAYOUT RATE response >>>")print(json.dumps(response,indent=2))AddPayoutRate Request Example{"id":"PZZA","trxPct":80,"trxFee":100}AddPayoutRate Response{"id":"DEMO.PZZA.1","app":"DEMO","account":"PZZA","version":1,"trxPct":80,"trxFee":100,"monthlyFee":0,"monthlyPayDate":0,"yearlyFee":0,"yearlyPayMonth":0,"status":null,"payFrequency":null,"startDate":null,"endDate":null,"autoApproveLimit":0,"lastMontlyPayout":null,"lastYearlyPayout":null,"lastDailyTrxPayout":null,"lastWeeklyTrxPayout":null,"lastMontlyTrxPayout":null,"timestamp":"2021-02-28T19:00:19.1518640Z","userId":null}Start PayoutsStart Payouts for an Existing Accountid should be the unique identifier for an existing Payout Account"status": "A" means payout has been activated, so make sure you see that in the responseimportjsonrequest={"id":"PZZA",}print("START PAYOUTS request >>>")print(json.dumps(request,indent=2))response=payout.StartPayouts(request)print("START PAYOUTS response >>>")print(json.dumps(response,indent=2))StartPayouts Request Example_{"id":"PZZA",}StartPayouts Response_{"id":"DEMO.PZZA.6","app":"DEMO","account":"PZZA","version":6,"trxPct":80,"trxFee":100,"monthlyFee":0,"monthlyPayDate":0,"yearlyFee":0,"yearlyPayMonth":0,"status":"A","payFrequency":null,"startDate":null,"endDate":null,"autoApproveLimit":0,"lastMontlyPayout":null,"lastYearlyPayout":null,"lastDailyTrxPayout":null,"lastWeeklyTrxPayout":null,"lastMontlyTrxPayout":null,"timestamp":"2021-03-01T23:34:36.1005288Z","userId":null}Stop PayoutsStop Payouts for an Existing Accountid should be the unique identifier for an existing Payout Account"status": "D" means payout has been deactivated, so make sure you see that in the responseimportjsonrequest={"id":"PZZA",}print("STOP PAYOUTS request >>>")print(json.dumps(request,indent=2))response=payout.StopPayouts(request)print("STOP PAYOUTS response >>>")print(json.dumps(response,indent=2))StopPayouts Request Example{"id":"PZZA",}StopPayouts Response{"id":"DEMO.PZZA.7","app":"DEMO","account":"PZZA","version":7,"trxPct":80,"trxFee":100,"monthlyFee":0,"monthlyPayDate":0,"yearlyFee":0,"yearlyPayMonth":0,"status":"D","payFrequency":null,"startDate":null,"endDate":null,"autoApproveLimit":0,"lastMontlyPayout":null,"lastYearlyPayout":null,"lastDailyTrxPayout":null,"lastWeeklyTrxPayout":null,"lastMontlyTrxPayout":null,"timestamp":"2021-03-01T23:34:36.1005288Z","userId":null}