Syncd API
Payment Methods
Payment methods are used to indicate the method of payment (e.g. company credit, personal credit, company cash, etc.) for expense receipts. Payment methods are especially useful because they convey whether expenses are reimbursable.
In order to use payment methods, expenses and payment methods must be enabled. Verify this with the Account Information interface (account / expense-settings
). Administrators can enable expenses and payment methods from Syncd's web interface via Settings / Expense Tracking.
There is no concept of payment method assignment; every user can view all payment methods. Only Payment Method Managers can create, update and delete payment methods.
Show
Request
GET /payment_methods/#{payment-method-id}.xml
Response
Status: 200 OK <payment-method> <id type="integer">121</id> <name>Company cash</name> <code nil="true"></code> <description nil="true"></description> <url nil="true"></url> <active type="boolean">true</active> <reimbursable type="boolean">false</reimbursable> <!-- if include=timestamps --> <created-at type="datetime">2007-08-16T20:49:05Z</created-at> <updated-at type="datetime">2008-07-12T13:30:38Z</updated-at> <!-- end --> </payment-method>
List
Request
All payment-methods:
GET /payment_methods.xml
All active payment-methods:
GET /payment_methods/active.xml
All inactive payment-methods:
GET /payment_methods/inactive.xml
Optional parameters
Specify start
and end
to request a specific range of items. For example:
GET /payment_methods.xml?start=1&end=4
Response
Status: 200 OK <payment-methods type="array"> <payment-method> ... </payment-method> ... </payment-methods>
Create
Request
POST /payment_methods.xml
Include the following data with your request:
<payment-method> <!-- name (required, unique, max-length=50) --> <name>Petty cash</name> <!-- active (optional boolean, default=true) --> <active>true</active> <!-- code (optional identifier, max-length=50) --> <code>PC</code> <!-- description (optional, max-length=255) --> <description>Money taken from petty cash box</description> <!-- url (optional external link, max-length=255) --> <url></url> <!-- reimbursable (optional boolean, default=false) --> <reimbursable>false</reimbursable> </payment-method>
Response
Status: 201 Created <payment-method> <id type="integer">#{new-payment-method-id}</id> <name>Petty cash</name> <active type="boolean">true</active> <code>PC</code> <description>Money taken from petty cash box</description> <url nil="true"></url> <reimbursable type="boolean">false</reimbursable> </payment-method>
Update
Request
PUT /payment_methods/#{payment-method-id}.xml
Include ANY of the following data with your request:
<payment-method> <name>Petty cash</name> <active>true</active> <code>PC</code> <description>Money taken from petty cash box</description> <url></url> <reimbursable>false</reimbursable> </payment-method>
Response
Status: 200 OK
Delete
Payment methods associated with expense receipts can not be deleted. Instead, deactivate them (update the payment-method, setting active
to false
).
Request
DELETE /payment_methods/#{payment-method-id}.xml
Response
Status: 200 OK