Returns a paged list of Payments/Credits/Refunds. The transactions are sorted in descending order by effectiveDate Defaults used if the query string parameters are missing:
offset=0
max=50
status = ignored if not provided
amount = ignored if not provided
customerId = ignored if not provided (i.e, returns a list of all customers)
In general,Payments, Refunds and Credits are represented internally as a "Payment" entity, and differentiated by a "paymentType" property which could be either "Payment", "Refund" or "Credit".
Note that the "amount" property will be negative for Refunds.
There are two approaches to making a payment, either by passing in a PaymentMethod (such as a credit card, ACH, Check, etc.) or by using a pre-existing stored auto-pay PaymentMethod (added to the Customer previously via a POST /rest/customer/[id]/autopay)
The returned output from all these calls is a payment instance, i.e., same return as a /rest/payment/[id]?format=xml
POST /rest/payments?format=xml
POST /rest/refunds? format=xml
POST /rest/credits?format=xml
POST /rest/payments/autopay?format=xml
POST /rest/refunds/autopay?format=xml
POST /rest/payments?format=xml&extCustomerRef=[code]
In the following XML, note that:
- action could be one of "processPayment", "processCredit" or "processRefund".
- The <paymentMethodDTO> is a generic data transfer object that holds the actual payment method used for remittance (as indicated by the "type" attribute). Inside the we could have one of creditCardPaymentMethod, achPaymentMethod, checkPaymentMethod, or cashPaymentMethod. The element must be set to the appropriate value.
- If the <generateInvoice> XML element value is set to "true", then the billing run for this customer is initiated, and on completion, the resulting unpaid invoices are target for this payment.
- The Invoice ID indicates which invoices the payment is to be applied against.
- As before, if you wish to reference the customer by your external reference value (rather than the BluBilling assigned numeric customer id), then use the "extCustomerRef=[code]" querystring parameter.
POST /rest/payments? format=xml
<processPayment>
<customer id="11"/>
<amount>3430.95</amount>
<currencyCode>USD</currencyCode>
<generateInvoice>false</generateInvoice>
<effectiveDate>2010-12-31</effectiveDate>
<invoiceText/>
<purchaseDescription/>
<internalNotes/>
<invoices>
<invoice id="34" />
</invoices>
<paymentMethodDTO type="CreditCard">
<creditCardPaymentMethod>
<autopayPreference>1</autopayPreference> <!-- Set this to 1, 2, or 3 to save this as the preferred auto-pay for this customer -->
<cardNumber>...</cardNumber>
<expiry>...</expiry>
<cardType>Visa</cardType>
...
</creditCardPaymentMethod>
</paymentMethodDTO>
</processPayment>
A sample response is shown below. The <status> element will be "Paid" on success with the <amount> element representing the amount that was actually transacted.
<payment id="213">
<isSystemPayment>true</isSystemPayment>
<customer id="11" />
<paymentMethodType>CreditCard</paymentMethodType>
<currency id="USD" />
<amount>3430.95</amount>
<balance>0.00</balance>
<effectiveDate>2011-09-06</effectiveDate>
<status>Paid</status>
<paymentType>Payment</paymentType>
<lastUpdated>2011-09-07</lastUpdated>
<isProcessedByBillingRun>false</isProcessedByBillingRun>
<baseUser id="351">
<username>jdoe</username>
<firstName>Jane</firstName>
<lastName>Doe</lastName>
</baseUser>
<processorResult id="192">
<errorMessage />
<transactionId>2162704713</transactionId>
<batchIndicator />
<isSuccess>true</isSuccess>
<customer id="11" />
<statusCode>1</statusCode>
<amount>3430.95</amount>
<avsCode>Y</avsCode>
<isError>false</isError>
<currencyCode>USD</currencyCode>
<payment id="213" />
<processorRequestType>AUTH_CAPTURE</processorRequestType>
<responseTimeMilliSec>3741</responseTimeMilliSec>
<lastUpdated>2011-09-07</lastUpdated>
<approvalCode>0S33CM</approvalCode>
<statusMessage>RRC_1_1 : This transaction has been approved.</statusMessage>
<cvvCode>X</cvvCode>
<errorCode />
<dateCreated>2011-09-07</dateCreated>
<secondaryAmount>0.00</secondaryAmount>
</processorResult>
<paymentMethodContext>Visa: 1111</paymentMethodContext>
<dateCreated>2011-09-07</dateCreated>
<paymentProcessor id="6">
<name>Authorize.NET V1</name>
</paymentProcessor>
<invoicePayments>
<invoicePayment id="171">
<payment id="213" />
<amountApplied>60.50</amountApplied>
<invoice id="34" />
<balanceRemaining>0.00</balanceRemaining>
<customer id="11" />
</invoicePayment>
</invoicePayments>
</payment>
On the other hand, if a transaction with an autopay is required, then we'd use one of the calls below. The Invoice ID indicates which invoices the payment is to be applied against.
POST /rest/payments/autopay
POST /rest/payments/autopay&extCustomerRef=[code]
<processPaymentWithAutopay>
<customer id="377" /> <!-- not required if extCustomerRef is supplied in querystring -->
<currencyCode>USD</currencyCode>
<amount>199.00</amount>
<effectiveDate>2011-09-28</effectiveDate>
<invoiceText></invoiceText>
<purchaseDescription></purchaseDescription>
<internalNotes></internalNotes>
<invoices>
<invoice id='2492' />
</invoices>
<autopayPreference>1</autopayPreference> <!-- defaults to 1 if not supplied -->
</processPaymentWithAutopay>