Create credit record with customer invoice (top-up or part payment)

POST/credit-record-invoices

Creates a credit record on a total balance (shared wallet) and, in the same operation, creates a linked customer invoice in the finance layer. The balance’s billing type decides whether you get a prepaid top-up or a postpaid part payment credit row, and how the invoice is submitted (including optional payment data).

Privileges (one of the following based on the deployment type):

  • bulk-billing-cust-topup.manage
  • bulk-billing-supplier-topup.manage
  • bulk-billing-cust-mnp-topup.manage
  • bulk-billing-supplier-mnp-topup.manage

Audit event:

  • credit.record.invoice.add

Errors:

  • 30 - Total Balance with given id not found
  • JSON_DECODING_ERROR - Unable to decode request body
  • NOT_AUTHENTICATED - Not authenticated
  • NOT_AUTHORIZED - Not authorized
  • INT_APP_ERROR - Unexpected internal error
  • NOT_PLATFORM_OWNER - Not authorized - not platform owner
  • INVALID-DATA - Input data validation failed

Error items:

  • invalid value - Total Balance with given id not found
  • invalid total balance - Cannot add credit to total balance with 'draft', 'inactive' or 'deleted' status
  • invalid value - Float value greater than 0 is expected
  • invalid value - Comment cannot be longer than 200 characters
  • invalid value - Payment type can not be 0
  • invalid value - Payment type must be in (1,2,3,4)
  • invalid value - Bank account with given id not found
  • invalid value - Bank account currency and total balance currency do not match
  • BILLING_INV_UID_TOO_LONG - invUid cannot be longer than 40 characters
  • BILLING_INV_UID_INVALID - invUid must be a valid UUID
  • BILLING_INV_UID_ALREADY_EXISTS - Invoice with given invUid already exists
Base URL
https://api-cpaas.sms.es/bulk/billing/v2
Authentication

OAuth2 — send Authorization: Bearer <access_token>. Token URL: https://accounts-cpaas.sms.es/oauth2/access-token

Request

Body required

application/json
amountnumber (double)required

Monetary amount; must be strictly greater than zero.

balanceIdinteger (int64)required

Total balance (wallet) id that will receive the credit row and own the invoice link.

commentstring

Optional comment stored on the credit record (max 200 Unicode characters).

invUidstring (uuid)

Optional invoice UID. When omitted or empty, sit-api generates a UUID automatically. When provided, must be a valid UUID (max 40 characters) and must not already exist in finance invoices. Validation error codes: BILLING_INV_UID_TOO_LONG, BILLING_INV_UID_INVALID, BILLING_INV_UID_ALREADY_EXISTS.

max length: 40
paymentobject

Optional payment hints sent with POST /credit-record-invoices. When fullyPaid is true, paymentType is validated and bankAccountId may be resolved against platform-owner bank accounts for the balance owner and currency.

Show child attributes
bankAccountIdinteger

Platform-owner bank account id for bank transfer (paymentType 1). 0 means “unspecified”; for fullyPaid true and type 1, the server may fill the default account for the balance currency when one exists.

fullyPaidboolean

When true, paymentType must be 1–4 (not 0). Drives whether a full payment is posted (postpaid) or how finance receives payment data (prepaid).

paymentTypeinteger

Payment instrument code used by the finance layer:

  • 1 — bank transfer
  • 2 — credit card
  • 3 — PayPal
  • 4 — cash

Request example

cURL · cURL
curl -L -X POST "https://api-cpaas.sms.es/bulk/billing/v2/credit-record-invoices" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access_token>" \
  --data-raw '{
  "amount": 100.5,
  "balanceId": 11,
  "comment": "Wire transfer received"
}'

Responses

Created — one object that contains credit record fields and nested invoice object when the finance service returns invoice data.
The nested invoice includes invUid (from the request when provided, otherwise auto-generated by sit-api).

application/json
activationDatestring (date)

Business date of the credit record.

aggregateFromDatestring (date)

Aggregate range start date when this row represents an aggregate record.

amountnumber (double)

Total amount of the credit record.

balanceIdinteger (int64)

Total balance / wallet id this credit record belongs to.

balanceNamestring

Human-readable total-balance name.

billingRecordIdinteger (int64)

Linked billing-record id when one exists.

billingTypeinteger (int64)

Billing type resolved from the credit record type metadata.

bizPartnerIdinteger (int64)

Business partner id resolved for this credit record.

bizPartnerNamestring
bizPartnerShortNamestring
commentstring

Optional free-text comment stored on the credit record.

conditionalAmountnumber (double)

Conditional amount tracked on the credit record.

createInvoicestring

Whether the linked credit-record type is configured to create invoices.

Possible values: yes, no
creationDatestring (date)

Date derived from the stored credit-record history timestamp.

creditAmountnumber (double)

Portion still allowed as usable credit according to the credit workflow.

creditUidstring

Stable public identifier of the credit record.

currencyinteger (int64)

Numeric currency id.

currencyCodestring
currencyNamestring
idinteger (int64)
invoiceIdinteger (int64)

Linked invoice id when one is set.

isAggregateRecordstring

Aggregate-record flag as stored by billing.

orderingStatusstring

Ordering workflow status stored on the credit record.

Possible values: off, available, in-use, used
orderingStatusDtstring (date-time)

When the current ordering status was stored.

ownerBpBriefNamestring
ownerBpNamestring
ownerIdinteger (int64)
paidAmountnumber (double)

Amount already paid against this credit record.

selectedPriceListIdinteger (int64)

Price list id stored on the credit record when selection logic applies.

statusstring

Workflow status of the credit record. Rows in deleted status are not returned by the list endpoint.

typestring

Stable code name of the credit record type.

typeIdinteger (int64)

Credit record type id.

typeNamestring

Human-readable credit record type name.

unpaidAmountnumber (double)

Remaining unpaid amount.

invoiceobject

Nested invoice object returned after a successful credit-record-with-invoice create. It combines invoice header fields from the finance (SIT) customer invoice API with an items array of line items when the service returns them.

Many additional header fields (customer address, VAT, owner display names, delivery status, and so on) exist in real responses; they are allowed as extra properties so this schema stays open without listing every finance field.

Show child attributes
classCodeNamestring
currencyinteger
currencyCodestring
domainCodeNamestring
idinteger

Finance invoice id (matches invoiceId on the credit record when linked).

invDatestring (date)
invDueDatestring (date)
invNumberstring
invUidstring (uuid)

Invoice UID. Equals the optional request invUid when the client provided one; otherwise the UUID generated by sit-api on create.

max length: 40
itemsobject[]

Invoice line items (items in JSON).

paymentStatusstring
statusstring
totalnumber (double)
totalPaidnumber (double)
totalUnpaidnumber (double)
Example response
{
  "activationDate": "2026-04-01",
  "aggregateFromDate": "0001-01-01",
  "amount": 100.5,
  "balanceId": 11,
  "balanceName": "Main wallet",
  "billingRecordId": 0,
  "billingType": 1,
  "bizPartnerId": 5001,
  "bizPartnerName": "Customer A",
  "bizPartnerShortName": "CustA",
  "comment": "Wire transfer received",
  "conditionalAmount": 0,
  "createInvoice": "yes",
  "creationDate": "2026-04-01",
  "creditAmount": 0,
  "creditUid": "f06a4e6f-4b0a-4f97-9c9c-6b2ce4a5bb73",
  "currency": 978,
  "currencyCode": "EUR",
  "currencyName": "Euro",
  "id": 1205,
  "invoice": {
    "classCodeName": "CUSTOMER_INVOICE",
    "currency": 978,
    "currencyCode": "EUR",
    "domainCodeName": "BULK",
    "id": 91001,
    "invDate": "2026-04-01",
    "invDueDate": "2026-04-01",
    "invNumber": null,
    "invUid": "f06a4e6f-4b0a-4f97-9c9c-6b2ce4a5bb73",
    "items": [
      {
        "id": 1,
        "invoiceId": 91001,
        "name": "Top-up credit",
        "ordNum": 1,
        "price": 100.5,
        "quantity": 1,
        "totalNoVat": 100.5,
        "totalVat": 0
      }
    ],
    "paymentStatus": "unpaid",
    "status": "approved",
    "total": 100.5,
    "totalPaid": 0,
    "totalUnpaid": 100.5
  },
  "invoiceId": 91001,
  "isAggregateRecord": "no",
  "orderingStatus": "off",
  "orderingStatusDt": "2026-04-01T12:00:00Z",
  "ownerBpBriefName": "Owner",
  "ownerBpName": "Owner Ltd",
  "ownerId": 7001,
  "paidAmount": 0,
  "selectedPriceListId": 0,
  "status": "active",
  "type": "topup",
  "typeId": 1,
  "typeName": "Top-up",
  "unpaidAmount": 0
}