Merchants
Merchants are a core part of the Cari Finance platform, allowing you to handle financial transactions securely and efficiently. On this page, we'll dive into the different merchant endpoints you can use to manage merchants programmatically. We'll look at how to query, create, update, and delete merchants.
The merchant model
The merchant model contains all the information about a merchant, such as the name, email, and phone number. It also includes metadata about the merchant, such as when it was created and last updated.
Properties
- Name
id
- Type
- string
- Description
Unique identifier for the merchant.
- Name
name
- Type
- string
- Description
The name of the merchant.
- Name
email
- Type
- string
- Description
The email of the merchant.
- Name
phone
- Type
- string
- Description
The phone number of the merchant.
- Name
currency
- Type
- string
- Description
The currency of the merchant (e.g., "usd").
- Name
status
- Type
- string
- Description
The status of the merchant (e.g., "succeeded", "pending").
- Name
created_at
- Type
- timestamp
- Description
Timestamp of when the merchant was created.
- Name
updated_at
- Type
- timestamp
- Description
Timestamp of when the merchant was last updated.
List all charges
This endpoint allows you to retrieve a list of all charges.
Request
curl -G https://api.cari.finance/charges \
-H "Authorization: Bearer {token}"
Response
[
{
"id": "charge_id_1",
"amount": 1000,
"amount_captured": 1000,
"amount_refunded": 0,
"currency": "usd",
"created": 1697040000,
"status": "succeeded",
"created_at": "2023-10-11T00:00:00",
"updated_at": "2023-10-11T00:00:00"
// ... other fields ...
}
// ... more charges ...
]
Create a charge
This endpoint allows you to create a new charge. You must provide the necessary payment details.
Request
curl -X POST https://api.cari.finance/charges \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"amount": 1000,
"provider": "card",
"currency": "usd",
"card": {
"token": "card_token"
}
}'
Response
{
"id": "charge_id_1",
"amount": 1000,
"amount_captured": 1000,
"currency": "usd",
"status": "succeeded",
"created_at": "2023-10-11T00:00:00",
"updated_at": "2023-10-11T00:00:00"
// ... other fields ...
}
Retrieve a charge
This endpoint allows you to retrieve a specific charge by its ID.
Request
curl https://api.cari.finance/charges/{id} \
-H "Authorization: Bearer {token}"
Response
{
"id": "charge_id_1",
"amount": 1000,
"amount_captured": 1000,
"currency": "usd",
"status": "succeeded",
"created_at": "2023-10-11T00:00:00",
"updated_at": "2023-10-11T00:00:00"
// ... other fields ...
}
Update a charge
This endpoint allows you to update a charge. Currently, you can update the amount
or status
.
Request
curl -X PUT https://api.cari.finance/charges/{id} \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"amount": 1500,
"status": "pending"
}'
Response
{
"id": "charge_id_1",
"amount": 1500,
"amount_captured": 1000,
"currency": "usd",
"status": "pending",
"created_at": "2023-10-11T00:00:00",
"updated_at": "2023-10-11T00:00:00"
// ... other fields ...
}
Delete a charge
This endpoint allows you to delete a charge by its ID.
Request
curl -X DELETE https://api.cari.finance/charges/{id} \
-H "Authorization: Bearer {token}"
Response
{
"message": "Charge deleted successfully"
}