Gestionar subcuentas

Utilice nuestra API para manejar subcuentas fácilmente: crear, eliminar, obtener información y transferir saldo. Ideal para todos aquellos que desean gestionar su estructura de cuentas de manera clara y eficiente.


GET/api/subaccounts?action=read

Listar subcuentas

Solicite una lista de todas las subcuentas de una cuenta.

Parámetros

  • Name
    id
    Type
    integer
    Optional
    Optional
    Description

    El ID de una subcuenta. Con esto, solo obtendrá los datos de una subcuenta específica.

Solicitud

GET
/api/subaccounts
curl -G https://gateway.seven.io/api/subaccounts?action=read \
    -H "X-Api-Key: SU_CLAVE_API" \
    -H "Accept: application/json"

Respuesta

[
    {
        "id": "1234567891",
        "username": null,
        "company": "Company 1",
        "balance": "36.8100",
        "total_usage": "0.3000",
        "auto_topup": {
            "threshold": "1",
            "amount": "5"
        },
        "contact": {
            "name": "John Doe",
            "email": "sms@acme-company1.com"
        }
    },
    {
        "id": "1234567892",
        "username": "push2app",
        "company": "Another Company",
        "balance": "120.4000",
        "total_usage": "0.0000",
        "auto_topup": {
            "threshold": null,
            "amount": null
        },
        "contact": {
            "name": "Donald Dummy",
            "email": "contact@another-acme-company.com"
        }
    }
]

POST/api/subaccounts?action=create

Crear subcuenta

Cree una subcuenta a través de la API.

Parámetros

  • Name
    name
    Type
    string
    Description

    Nombre completo del propietario de la cuenta.

  • Name
    email
    Type
    string
    Description

    Dirección de correo electrónico de la cuenta.

Solicitud

POST
/api/subaccounts?action=create
curl -G https://gateway.seven.io/api/subaccounts?action=create \
    -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
    -d "name=John Doe" \
    -d "email=john.doe@acme-inc.com"

Respuesta exitosa

{
    "success": true,
    "error": null,
    "subaccount": {
        "id": "123456789",
        "username": null,
        "company": null,
        "balance": 0,
        "total_usage": 0,
        "auto_topup": {
            "threshold": 0,
            "amount": 0
        },
        "contact": {
            "name": "John Doe",
            "email": "john.doe@acme-inc.com"
        }
    }
}

Antwort bei Fehler

{
            "success": false,
            "error": "Invalid request"
        }

POST/api/subaccounts?action=update

Automatische Guthabenübertragung

Con esta API, puede configurar la transferencia automática de saldo para una subcuenta. Esta puede transferir saldo del cuenta principal a la subcuenta cuando se baja de un umbral establecido. Para desactivar, simplemente establezca amount en 0.

Parámetros

  • Name
    id
    Type
    integer
    Description

    El ID de la subcuenta.

  • Name
    threshold
    Type
    float
    Description

    El umbral de saldo por debajo del cual se debe transferir el saldo.

  • Name
    amount
    Type
    float
    Description

    La cantidad de saldo que se enviará del cuenta principal a la subcuenta cuando se baje de threshold.

Anfrage

POST
/api/subaccounts?action=update
curl -G https://gateway.seven.io/api/subaccounts?action=update \
    -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
    -d "id=49176123456789" \
    -d "threshold=100.0" \
    -d "amount=200.0"

Antwort im Erfolgsfall

{
    "success": true,
    "error": null
}

POST/api/subaccounts?action=transfer_credits

Manuelle Guthabenübertragung

Con esta API, puede transferir saldo del cuenta principal a la subcuenta una sola vez.

Parámetros

  • Name
    id
    Type
    integer
    Description

    ID de la subcuenta.

  • Name
    amount
    Type
    float
    Description

    Saldo a transferir.

Anfrage

POST
/api/subaccounts?action=transfer_credits
curl -G https://gateway.seven.io/api/subaccounts?action=transfer_credits \
    -H "X-Api-Key: IHR_API_SCHLÜSSEL" \
    -d "id=123456789" \
    -d "amount=250.0"

Antwort

{
    "success": true,
    "error": null
}

POST/api/subaccounts?action=delete

Eliminación de Subcuentas

Con esta API se pueden eliminar subcuentas usando su ID.

Parámetros

  • Name
    id
    Type
    integer
    Description

    ID de la subcuenta.

Request

POST
/api/subaccounts?action=delete
curl -G https://gateway.seven.io/api/subaccounts?action=delete \
    -H "X-Api-Key: SU_CLAVE_API" \
    -d "id=123456789"

Respuesta

{
    "success": true,
    "error": null
}