You are here: CashBox1800APIGuide > The PaymentMethod Object

11  The PaymentMethod Object

The PaymentMethod object defines a customer’s method of paying for your product or service. This is an umbrella object that encapsulates the subobjects that specify the details of various payment types, such as credit card, electronic check, and PayPal. An instance of the PaymentMethod object refers to only one payment type. When creating an instance, specify the payment type to which this object refers by populating the type attribute and then adding the related details. For example, for a credit-card payment, add details such as the card number and its expiration date in the corresponding subobject.

Although this object offers methods to independently create a new payment method in CashBox, to validate payment, and so forth, you might create PaymentMethod objects indirectly through Account, AutoBill, or Transaction objects, as follows:

When creating an Account object, you can specify multiple PaymentMethod objects owned by the account in the paymentMethods attribute of the Account object.

When creating an AutoBill object, you can specify a payment method for the rebilling transactions generated by the AutoBill object in its paymentMethod attribute. Otherwise, the AutoBill rebill transactions use the payment method available with the account.

When creating a Transaction object, you can specify the sourcePaymentMethod attribute to define the means by which this transaction will be paid.

In the last two cases, CashBox creates the PaymentMethod object and associates it with the underlying Account object. For example, if you specify a PaymentMethod object in a Transaction object’s sourcePaymentMethod attribute, CashBox attaches the PaymentMethod object to the Account object on the Transaction object. You can turn off this behavior by setting the active flag on the PaymentMethod object to false.