-
Notifications
You must be signed in to change notification settings - Fork 85
Payment
Bogdan Petrea edited this page Nov 16, 2016
·
2 revisions
For resource definition check out Resources page.
GET /customers/<customer_id>/payments/
Available filters: amount, currency, due_date, status, visible, provider
[
{
"id": 1,
"url": "http://127.0.0.1:8000/customers/1/payments/1/",
"customer": "http://127.0.0.1:8000/customers/1/",
"provider": "http://127.0.0.1:8000/providers/1/",
"amount": "200.00",
"currency": "USD",
"due_date": null,
"status": "unpaid",
"visible": true,
"proforma": null,
"invoice": "http://127.0.0.1:8000/invoices/1/"
},
{...}
]
GET /customers/<customer_id>/payments/<payment_id>/
{
"id": 1,
"url": "http://127.0.0.1:8000/customers/1/payments/1/",
"customer": "http://127.0.0.1:8000/customers/1/",
"provider": "http://127.0.0.1:8000/providers/1/",
"amount": "200.00",
"currency": "USD",
"due_date": null,
"status": "unpaid",
"visible": true,
"proforma": null,
"invoice": "http://127.0.0.1:8000/invoices/1/"
}
POST /customers/<customer_id>/payments/
Payload:
{
"customer": "http://127.0.0.1:8000/customers/1/",
"provider": "http://127.0.0.1:8000/providers/1/",
"amount": "200.00",
"currency": "USD",
"due_date": null,
"status": "unpaid",
"visible": true,
"proforma": "http://127.0.0.1:8000/proformas/1/",
"invoice": "http://127.0.0.1:8000/invoices/1/"
}
Response:
HTTP 201 Created
{
"id": 1,
"url": "http://127.0.0.1:8000/customers/1/payments/1/",
"customer": "http://127.0.0.1:8000/customers/1/",
"provider": "http://127.0.0.1:8000/providers/1/",
"amount": "200.00",
"currency": "USD",
"due_date": null,
"status": "unpaid",
"visible": true,
"proforma": "http://127.0.0.1:8000/proformas/1/",
"invoice": "http://127.0.0.1:8000/invoices/1/"
}
PATCH /customers/<customer_id>/payments/<payment_id>/
Payload:
{
"status": "pending"
}
Response:
HTTP 200 OK
{
"id": 1,
"url": "http://127.0.0.1:8000/customers/1/payments/1/",
"customer": "http://127.0.0.1:8000/customers/1/",
"provider": "http://127.0.0.1:8000/providers/1/",
"amount": "200.00",
"currency": "USD",
"due_date": null,
"status": "pending",
"visible": true,
"proforma": "http://127.0.0.1:8000/proformas/1/",
"invoice": "http://127.0.0.1:8000/invoices/1/"
}
The status field is the only field that can be modified after the payment's creation. If there is an on-going transaction for this payment, then the payment cannot be modified.