Easy-Acumatica Docs

Payments Service

The `PaymentsService` is used for creating, retrieving, and managing `Payment` records in Acumatica. This includes creating standalone payments and processing them through to financial release.

Importing Helpers

To create and query payments, you'll need the `PaymentBuilder` and `QueryOptions` helpers from the `easy_acumatica.models` module.

python

from easy_acumatica.models.payment_builder import PaymentBuilder  
from easy_acumatica.models.query_builder import QueryOptions

Service Methods

create_payment(api_version, builder)

Creates a new Payment record. This method is versatile and can be used to create payments that are applied to specific documents or standalone payments not linked to an invoice. You must provide a `PaymentBuilder` object with all the required details.

python

# Build the payment payload
payment_builder = (
    PaymentBuilder()
    .type("Payment")
    .customer_id("AACUSTOMER")
    .payment_amount(150.00)
    .cash_account("10200") # Specify the cash account
    .add_document_to_apply("Invoice", "AR004792") # Apply to a specific invoice
)

# Create the payment
new_payment = client.payments.create_payment("24.200.001", payment_builder)
get_payment(api_version, payment_type, reference_nbr, options=None)

Retrieves a single payment record identified by its key fields: `payment_type` (e.g., 'Payment', 'Prepayment') and `reference_nbr`. You can use `QueryOptions` to expand related data, but filtering is not allowed as the record is already uniquely identified.

python

from easy_acumatica.models import QueryOptions

# Define options to expand the application history
opts = QueryOptions(expand=["ApplicationHistory"])

# Get a specific payment by its type and reference number
payment_details = client.payments.get_payment(
    "24.200.001",
    payment_type="Payment",
    reference_nbr="001864",
    options=opts
)
release_payment(api_version, payment_type, reference_nbr, ...)

Invokes the `Release` action for a payment, which triggers the financial posting process. This is often an asynchronous operation on the server, and this method automatically handles the polling required to wait for its completion.

python

# Release a specific payment to post it financially
client.payments.release_payment(
    "24.200.001",
    payment_type="Payment",
    reference_nbr="001864"
)

print("Payment has been released.")
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