Create payment record (mark invoice as paid)
POST https://:subdomain.cobot.me/api/invoices/:invoice_id/payment_records
Adds a payment record to an invoice. Once the total amount has been paid the invoice is marked as paid.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- write_payment_records
Example
POST https://co-up.cobot.me/api/invoices/329797324595/payment_records
Body:
{
"note": "optional note",
"paid_at": "2014-01-25",
"amount": "200.5",
"payment_method": {
"id": "949625d63f946310"
}
}
payment_method
is optional. You can either pass in the id
of a payment method, in which case the name is automatically populated, or a name, in which case id
is null.
Response: on success returns a 201 status and the record as JSON:
{
"id": "2396259632946386",
"invoice_id": "329797324595",
"note": "optional note",
"paid_at": "2014-01-25",
"amount": "200.5",
"currency": "EUR",
"payment_method": {
"id": "949625d63f946310",
"name": "credit card"
}
}
Otherwise returns a 422 status and the errors:
{
"errors": "Paid at can't be blank"
}
Delete payment record
DELETE https://:subdomain.cobot.me/api/invoices/:invoice_id/payment_records/:id
Deletes a payment record from an invoice.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- write_payment_records
Example
DELETE https://co-up.cobot.me/api/invoices/329797324595/payment_records/6352
Responds with 204 code.
List payment records
GET https://:subdomain.cobot.me/api/invoices/payment_records?from=:from&to=:to
Lists all payment records for all invoices created in the given timespan. Instead of from/to you can also provide a comma separated list of invoice ids (?invoice_ids=:id1,:id2
)
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- read_payment_records
Example
GET https://co-up.cobot.me/api/invoices/payment_records?from=2014-01-01 00:00:00 +0000&to=2014-01-31 23:59:59 +0000
Response: returns a 200 status and the records as JSON:
[
{
"id": "2396259632946386",
"invoice_id": "329797324595",
"note": "optional note",
"paid_at": "2014-01-25",
"amount": "200.5",
"currency": "EUR",
"payment_method": {
"id": "949625d63f946310",
"name": "credit card"
}
}
]
The payment method id and name can be null
. Even if an id is returned, the corresponding payment method could have been deleted.
Returns a 400 status code if to/from parameters are missing.
List payment records by payment date
GET https://:subdomain.cobot.me/api/payment_records?from=:from&to=:to
Lists all payment that have been paid in the given timespan.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- read_payment_records
Example
GET https://co-up.cobot.me/api/payment_records?from=2014-01-01 00:00:00 +0000&to=2014-01-31 23:59:59 +0000
Response: returns a 200 status and the records as JSON:
[
{
"id": "2396259632946386",
"invoice_id": "329797324595",
"note": "optional note",
"paid_at": "2014-01-25",
"amount": "200.5",
"currency": "EUR",
"payment_method": {
"id": "949625d63f946310",
"name": "credit card"
}
}
]
Returns a 400 status code if to/from parameters are missing.