AltScore
Credit Management System (CMS)

Payment Accounts API

This API allows managing payment accounts for customers. It provides endpoints to create, read, and manage accounts and payment references.

Payment accounts function as a unique or universal account for a customer, with multiple payment references to accept payments for credits/loans through different methods. Currently, two payment providers are supported:

  • DAPP: For cash payments through physical stores
  • STP: For electronic bank transfers

The CMS Base URL is used (see introduction).

Table of Contents

The Account Object

The Account Object represents an account for receiving payments from different sources and methods.

{
    "accountId": "55512717-110c-4801-bd5c-85d9cf401134",
    "accountHolder": {
        "name": "JOHN DOE",
        "phone": "+5215512345678",
        "email": "john.doe@example.com",
        "partnerId": "0ab1aeac-2145-4096-9435-4768c5ebb579",
        "clientId": "965117da-f8cf-42b6-b8c2-3665a8029b36"
    },
    "references": [
        {
            "accountReferenceId": "10000000400000001",
            "gatewayId": "f8512717-110c-4801-bd5c-85d9cf401555",
            "provider": "dapp",
            "status": "active",
            "amount": {
                "amount": 1000,
                "currency": "MXN"
            },
            "reference": "1234567890",
            "createdAt": "2024-11-12T20:31:45.96382213Z",
            "updatedAt": "2024-11-12T20:31:45.963823237Z",
            "expirationAt": "2024-12-12T20:31:45.963823237Z"
        },
        {
            "accountReferenceId": "846180000400000002",
            "gatewayId": "e7722717-110c-4801-bd5c-85d9cf401666",
            "provider": "stp",
            "status": "active",
            "reference": "646180000400000001",
            "createdAt": "2024-11-12T20:31:45.96382213Z"
        }
    ],
    "createdAt": "2024-11-12T20:31:45.96382213Z",
    "updatedAt": "2024-11-12T20:31:45.963823237Z"
}

Attributes

AttributeDescriptionType
accountIdUnique identifier of the accountString (UUID)
accountHolderAccount holder informationObject
referencesList of payment references associated with the accountArray
createdAtAccount creation dateString (Datetime)
updatedAtDate of the last account updateString (Datetime)

Nested Object Details

accountHolder Object

AttributeDescriptionType
nameAccount holder's nameString
phoneAccount holder's phone number (optional)String
emailAccount holder's email (optional)String
partnerIdPartner identifier managing the accountString (UUID)
clientIdClient identifierString (UUID)

The AccountReference Object

The AccountReference object represents a payment reference associated with an account.

AttributeDescriptionType
accountReferenceIdUnique identifier of the referenceString (UUID)
gatewayIdPayment gateway identifierString (UUID)
providerPayment service provider (see providers table)String
statusPayment reference status (see reference statuses)String
amountAmount associated with the reference (optional)Object
referenceReference code for making the paymentString
createdAtReference creation dateString (Datetime)
updatedAtReference update dateString (Datetime)
expirationAtReference expiration date (optional)String (Datetime)

amount Object

AttributeDescriptionType
amountNumeric amountNumber
currencyCurrency code (e.g., MXN)String

Payment Account Operations

Create Payment Account

Creates a payment account for a specific customer.

POST /v1/accounts

Input Parameters

ParameterDescriptionTypeRequired
partnerIdPartner identifier managing the accountString (UUID)Yes
clientIdClient identifierString (UUID)Yes
customerNameCustomer's nameStringNo
customerPhoneCustomer's phone numberStringNo
customerEmailCustomer's emailStringNo
autoCreateReferencesAutomatically create references for configured payment methodsBooleanNo

Request Body

{
    "partnerId": "0ab1aeac-2145-4096-9435-4768c5ebb579",
    "clientId": "965117da-f8cf-42b6-b8c2-3665a8029b36",
    "customerName": "John Doe",
    "customerPhone": "+5215512345678",
    "customerEmail": "john.doe@example.com",
    "autoCreateReferences": true
}

Successful Response (201)

The response includes a created Account object with its payment references.

Specific Errors

Response CodeDescription
400Invalid request. This may occur if required parameters are missing or if the provided values are not valid.
404The client or partner does not exist
409An account already exists for the specified customer

Get Payment Account

Retrieves the information of a payment account for a specific customer.

GET /v1/accounts/{client-id}

Path Parameters

ParameterDescriptionTypeRequired
client-idClient identifierString (UUID)Yes

Successful Response (200)

The response includes an Account object with all its information and payment references of type AccountReference.

Specific Errors

Response CodeDescription
400Invalid request. This may occur if the provided values are not valid.
404The account does not exist for the specified customer.

Get Payment References

Retrieves the payment references associated with a specific customer account.

GET /v1/accounts/{client-id}/references

Path Parameters

ParameterDescriptionTypeRequired
client-idClient identifierString (UUID)Yes

Query Parameters

ParameterDescriptionTypeRequired
statusFilter by reference statusStringNo
providerFilter by reference providerStringNo

Successful Response (200)

The response includes an array of AccountReference objects associated with the customer's account.

Specific Errors

Response CodeDescription
400Invalid request. This may occur if the provided values are not valid.
404The account does not exist for the specified customer.

Create Payment Reference

Creates a new payment reference for an existing account.

POST /v1/accounts/{client-id}/references

Path Parameters

ParameterDescriptionTypeRequired
client-idClient identifierString (UUID)Yes

Input Parameters

ParameterDescriptionTypeRequired
providerPayment service provider (dapp, stp)StringNo
gatewayIdPayment gateway identifierString (UUID)No
amountAmount associated with the referenceObjectNo
durationDaysDuration in days of the reference's validityIntegerNo

Request Body

The request body must contain the necessary details to create a payment reference.

{
    "provider": "PAYNET",
    "gatewayId": "f8512717-110c-4801-bd5c-85d9cf401555",
    "amount": {
        "amount": 1000,
        "currency": "MXN"
    },
    "durationDays": 30
}

Successful Response (201)

The response includes an array of created AccountReference objects:

[
    {
        "accountReferenceId": "846180000400000001",
        "gatewayId": "f8512717-110c-4801-bd5c-85d9cf401555",
        "provider": "PAYNET",
        "status": "ACTIVE",
        "amount": {
            "amount": 1000,
            "currency": "MXN"
        },
        "reference": "1234567890",
        "createdAt": "2024-11-12T20:31:45.96382213Z",
        "updatedAt": "2024-11-12T20:31:45.963823237Z",
        "expirationAt": "2024-12-12T20:31:45.963823237Z"
    },
    {
        "accountReferenceId": "846180000400000002",
        "gatewayId": "e7722717-110c-4801-bd5c-85d9cf401666",
        "provider": "STP",
        "status": "ACTIVE",
        "reference": "646180000400000001",
        "createdAt": "2024-11-12T20:31:45.96382213Z"
    }
]

Specific Errors

Response CodeDescription
400Invalid request. This may occur if required parameters are missing or if the provided values are not valid.
404The account does not exist.
409A reference with the same parameters already exists.
422Unprocessable entity. Error in processing the request.

Status Values

Reference Statuses

Possible values for the status field in payment references:

StatusValueDescription
Active"ACTIVE"The reference is active and can receive payments
Cancelled"CANCELLED"The reference has been cancelled
Expired"EXPIRED"The reference has expired

Supported Payment Providers

Possible values for the provider field in payment references:

ProviderValueDescription
DAPP"dapp"Cash payments through physical stores
STP"stp"Electronic bank transfers