Transfers

Transfers 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 transfer endpoints you can use to manage transfers programmatically. We'll look at how to query, create, update, and delete transfers.

The transfer model

The transfer model contains all the information about a transfer, such as the amount, currency, and status. It also includes metadata about the transfer, such as when it was created and last updated.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the transfer.

  • Name
    amount
    Type
    integer
    Description

    The amount of the transfer in the smallest currency unit (e.g., cents).

  • Name
    amount_captured
    Type
    integer
    Description

    The amount captured from the transfer.

  • Name
    amount_refunded
    Type
    integer
    Description

    The amount refunded from the transfer.

  • Name
    currency
    Type
    string
    Description

    The currency of the transfer (e.g., "usd").

  • Name
    status
    Type
    string
    Description

    The status of the transfer (e.g., "succeeded", "pending").

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the transfer was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the transfer was last updated.


GET/v1/transfers

List all transfers

This endpoint allows you to retrieve a list of all transfers.

Request

GET
/v1/transfers
curl -G https://api.cari.finance/v1/transfers \
  -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 ...
]

POST/charges

Create a charge

This endpoint allows you to create a new charge. You must provide the necessary payment details.

Request

POST
/charges
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 ...
}

GET/charges/:id

Retrieve a charge

This endpoint allows you to retrieve a specific charge by its ID.

Request

GET
/charges/{id}
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 ...
}

PUT/charges/:id

Update a charge

This endpoint allows you to update a charge. Currently, you can update the amount or status.

Request

PUT
/charges/{id}
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/charges/:id

Delete a charge

This endpoint allows you to delete a charge by its ID.

Request

DELETE
/charges/{id}
curl -X DELETE https://api.cari.finance/charges/{id} \
  -H "Authorization: Bearer {token}"

Response

{
  "message": "Charge deleted successfully"
}

Was this page helpful?