Skip to main content

Accounts in Patterns B and C

This guide covers how to create receivable accounts when the owner is not just a client. For the simple case (a client without an operator), see Create a receivable account. To understand the patterns conceptually and decide which one to use, see Operating models.

The example conventions (HTTP client maxpay, deterministic Idempotency-Key) are the same as in the base guide.

Pattern B — Operator account

Typical case: operators who collect in bulk and report to the customer. End clients are not modeled.

const associate = await maxpay.post('/v1/associates', {
headers: { 'Idempotency-Key': `erp-asc-${erpAssociateId}` },
body: {
type: 'DRIVER',
name: 'Operario',
lastName: '042',
taxId: '20999999999',
documentNumber: '99999999',
phone: '+541111000042'
}
});

const account = await maxpay.post('/v1/receivable-accounts', {
headers: { 'Idempotency-Key': `erp-rac-asc-${erpAssociateId}` },
body: { associateId: associate.id }
});

Response

201 Created
Location: /v1/receivable-accounts/4243

{
"id": 4243,
"cvu": null,
"alias": null,
"currencyCode": "ARS",
"status": "PROVISIONING",
"owner": { "type": "ASSOCIATE", "id": 88 },
"creationDate": "...",
"modificationDate": "..."
}

Pattern C — Client account with assigned operator

This pattern can be built in a single call (client and operator already exist, and both are bound at creation) or in two phases (first Pattern A, then the operator is added with Post-hoc binding).

Case C.1 — Client with assigned driver

const account = await maxpay.post('/v1/receivable-accounts', {
headers: { 'Idempotency-Key': `erp-rac-${erpClientId}-${erpAssociateId}` },
body: {
clientId: 1042,
associateId: 88
}
});

Case C.2 — Educational model (student + guardian)

The student is modeled as a client and the payer (the adult student or guardian/parent) as an associate. Both may share the same taxId.

const student = await maxpay.post('/v1/clients', {
headers: { 'Idempotency-Key': `inst-edu-alumno-${legajo}` },
body: {
businessName: '...',
taxId: '20998888887',
documentType: 'CUIL',
externalId: legajo
}
});

const payer = await maxpay.post('/v1/associates', {
headers: { 'Idempotency-Key': `inst-edu-tutor-${legajo}` },
body: {
type: 'GUARDIAN',
name: '...',
taxId: '20998888887',
documentNumber: '99888888'
}
});

const account = await maxpay.post('/v1/receivable-accounts', {
headers: { 'Idempotency-Key': `inst-edu-rac-${legajo}` },
body: {
clientId: student.id,
associateId: payer.id
}
});

Common errors

Creation errors are the same as in Pattern A. See the table in Create a receivable account.