Customer Credits API Documentation
Overview
This sub-collection contains a customer account's credits, which may be redeemed in place of a payment.
Fields
Name | Type | Restrictions | Required? | Description |
---|---|---|---|---|
id | integer | Automatic | Automatic | The unique identifier of the credit. This is placed in the URL when making API calls for the credit. |
url | string | Automatic | Automatic | The unique API URL of the credit. |
amount_total | float | Must be greater than 0. May not be changed after creation. | Yes | The total value of this credit, in the gym's currency. |
amount_remaining | float | Automatic | Automatic | The value remaining on this credit, in the gym's currency. |
expiry_date | string (ISO-8601 date) | Must be an ISO-8601 date string, or null. | No | The last day that the credit may be used. The credit may be used until the end of this day, in the time zone of the gym. If this not set then the credit does not expire. |
expiry_date_str | string | Automatic | Automatic | The expiry date of the credit as a human-readable string. |
is_expired | boolean | Automatic | Automatic | Whether the credit has expired. |
is_removed | boolean | None | No | Whether the credit has been removed. Set this to true instead of deleting the credit. |
created_by_id | integer | Automatic | Automatic | The database ID of the gym staff user who created this credit. |
created_by_email | string | Automatic | Automatic | The email of the gym staff user who created this credit. |
date_added_str | string | Automatic | Automatic | The date the credit was created, as a human-readable string in the time zone of the gym. |
created_at | string (ISO-8601 datetime) | Automatic | Automatic | When the credit was added to the Capitan database. |
updated_at | string (ISO-8601 datetime) | Automatic | Automatic | When the credit's record in the Capitan database was last updated. |
Operations
List
Request GET /api/customers/35/credits/ Response 200 OK { "count": 2, "next": null, "previous": null, "results": [ { "id": 421, "url": "https://api.hellocapitan.com/api/customers/35/credits/421/", "amount_total": 37.12, ... }, ... ] }
Read
Request GET /api/customers/35/credits/421/ Response 200 OK { "id": 35, "url": "https://api.hellocapitan.com/api/customers/35/credits/421/", "amount_total": 37.12, ... }
Create
Request POST /api/customers/35/credits/ { "amount_total": 100.00 } Response 201 Created { "id": 713, "url": "https://api.hellocapitan.com/api/customers/35/credits/713/", "amount_total": 100.00, ... }
Replace
Request PUT /api/customers/35/credits/713/ { "is_removed": true } Response 200 OK { "id": 713, "url": "https://api.hellocapitan.com/api/customers/35/credits/713/", "amount_total": 100.00, ... }
Update
Request PATCH /api/customers/35/credits/713/ { "is_removed": true } Response 200 OK { "id": 713, "url": "https://api.hellocapitan.com/api/customers/35/credits/713/", "amount_total": 100.00, ... }