Easy-Acumatica Docs

PaymentBuilder

The `PaymentBuilder` is your primary tool for creating the JSON payload needed to create AR Payment records with the `PaymentsService`. It provides a fluent, chainable interface for setting payment fields and building complex nested lists, like documents to apply.

Importing the Builder

To get started, import the `PaymentBuilder` from the `easy_acumatica.models` module.

python

from easy_acumatica.models.payment_builder import PaymentBuilder

Builder Methods

Top-Level Fields

Use the shortcut methods to set common header-level fields on the payment record. For any field not listed, use the generic `.set()` method.

python

payment_payload = (
    PaymentBuilder()
    .type("Payment")
    .customer_id("CUST01")
    .payment_amount(150.75)
    .payment_method("CHECK")
    .payment_ref("CHK-1055")
    .cash_account("10200")
    .hold(False)
)
Adding Details to a Payment

The builder includes special methods for building the nested lists required for applying payments or including external transaction data.

.add_document_to_apply(...)

Adds a document like an invoice or credit memo to the `DocumentsToApply` list.

python

payment_payload.add_document_to_apply(
    doc_type="INV", 
    reference_nbr="INV00451", 
    doc_line_nbr=1
)

.add_order_to_apply(...)

Adds a sales order to the `OrdersToApply` list.

python

payment_payload.add_order_to_apply(
    order_type="SO", 
    order_nbr="SO00789"
)

.add_credit_card_transaction(...)

Adds externally processed credit card transaction data to the `CreditCardTransactionInfo` list.

python

payment_payload.add_credit_card_transaction(
    tran_nbr="ext_tran_id_12345",
    tran_type="Authorize and Capture",
    auth_nbr="auth_code_abc789"
)
Easy-Acumatica v0.3.9 — Created and Developed by Matthew Hirstius (Nioron07).
Significant Contributions made by Chris Xu
Want to see the NPM version? See it here