Introduction
As a business owner, you would want to design a seamless experience for your customers to subscribe to your business, improve the ease of making payments and create a consistent brand outlook. But building from scratch might require time, effort, and security worries.
With Mocha's advanced hosted pages solutions, you will now be able to easily set up subscription creation, management, and payments for your customers. Mocha Technologies is providing HTTP based APIs that follow the principles of REST. The HTTP rules followed allow simple HTTP clients like cURL to be used as well. The URLs are resource oriented, the request format is form-encoded and the responses are in JSON.
Depending on the type of operation, the endpoints use the following HTTP methods:
- GET– Used for all read-only operations for fetching or retrieving data from the server or listing a group of data.
- POST– Used for all write operations. It is used to send data to the server to create a new resource. Such operations modify the state of a resource.
- DELETE– Used for all delete operations. It is used to delete a resource on the server.
A history of changes to the API is provided in the API Change log.
Note: Sometimes, while working with Mocha APIs, you may find undocumented attributes returned in the response. Kindly ignore such attributes.
Resources
Mocha follows the REST model of exposing resources as urls. For examples, invoices are exposed as:
REQUEST:
The HTTP method like GET,POST and DELETE determines the operation type on the resource. Query parameters would allow you to provide additional options to the GET requests. POST parameters would provide the data to write operations like creation, modification of resources. DELETE is used to delete a resource on the server.
By default curl uses GET method. Use -X option to specify a specific HTTP method to use. For passing parameters, use -d option.
Note
cURL automatically uses the POST method if any parameter is sent via -d option.
RESPONSE:
The response is in JSON format. Currently Mocha does not support any other response format.
Note
Sometimes while working with Mocha APIs, you may find undocumented attributes returned in the response. Kindly ignore such attributes.
SAMPLE REQUEST:
curl -X GET \
'http://zoomac.sales/api/invoices' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json'SAMPLE RESPONSE [JSON]:
{
"code": 0,
"message": "success",
"invoice": {
"id": "inv_1a2b3c4d5e",
"amount": 1500,
"currency": "USD",
"status": "paid",
"customer": {
"id": "cust_xyz123",
"name": "John Doe",
"email": "john@example.com"
},
"created_at": "2025-01-15T10:30:00Z",
"paid_at": "2025-01-15T10:35:00Z"
}
}Open API Specification
Mocha Technologies supports the Open API Specification making it easier for developers to work with our APIs. The spec is compliant with OpenAPI v3.0.1, enabling customers to:
This is part of our commitment to providing a smoother, more efficient developer experience
Code Samples
The sample code snippets provided for the endpoints in this documentation are ready-to-test. Once you log in and select a language using the dropdown that appears at the top, the code samples in this documentation does not automatically include the API key. You would have to enter the API key separately.
Join The Mocha Community
Explore how our solutions can make a difference. Try Mocha Technologies today and discover a new level of business freedom and insight.