> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Account.makePayment

The `makePayment` method allows you to record a payment against an outstanding invoice. You can use this method to enter check or cash payments, payment of goods in trade, or payments made with active Payment Methods.

Using the `makePayment` method on the `Account` object causes Subscribe to allocate the payment to the oldest open invoice or AutoBill. To apply a payment directly to an outstanding AutoBill, use `AutoBill.makePayment` instead.

Whether you use a standard `PaymentMethod`, or a `MerchantAcceptedPayment`, the `makePayment` method generates a `Transaction`, and processes the `Transaction` through the `auth/capture` cycle appropriate to the input Payment Method. Credit Card, ECP, PayPal, and other standard Payment Methods are routed through the appropriate Payment Processor. The `MerchantAcceptedPayment` Payment Method is routed through Vindicia’s internal transaction process. Both Payment Method types appear as a Transaction in the Account’s history.

## Input

*srd*: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a `method` call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the *srd*. A null *srd* returns the complete response.

*account*: the `Account` to which this payment applies.

*paymentMethod*: the `PaymentMethod` to be used for this payment. This `paymentMethod` can be of type `MerchantAcceptedPayment`, credit card, or PayPal. If you use PayPal, the PayPal payment method must be already populated with a Billing Agreement ID (BAID), acquired either from an earlier AutoBill creation or from a one-time transaction conducted for the customer's account, in which a PayPal reference ID was requested. You can not use an PayPal payment method that requires customer approval at the PayPal site in this call.

**Note:** For tracking purposes, assign a unique ID for every `Account.makePayment` call that uses a `MerchantAcceptedPayment` Payment Method.

*amount*: the amount of the payment being made. (Required Float.)

*currency*: the ISO 4217 currency code for amount. This must match the currency used for charges on the current invoice. (If not specified, the AutoBill/Invoice currency will be used.)

*invoiceId*: the ID of the Invoice to make payment against. If not specified, the oldest unpaid invoice or AutoBill will be paid first. To make a payment against an invoice in `Open` status, an ID must be specified—Subscribe will not direct overage against such a future invoice.

For more information, see Working with Invoices in the Subscribe Programming Guide.

*overageDisposition*: an object of type *PaymentOverageDisposition*, defines how to allocate payments in excess of a required AutoBill payment amount. Enumerated values include:

* `applyToOldestInvoice`(the default)
* `applyToThisAutoBill`
* `applyToCredit`

*note*: an optional memo regarding the payment made.

## Output

*return*: an object of type `Return` that indicates the success or failure of the call.

*transaction*: the `Transaction` object reflecting the payment.

*summary*: an object of type `TransactionAttemptSummary` that includes the summary of the payment attempt.

## Returns

In addition to those listed in [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `400` | One of the following: - `Account not found.` - `Failed to translate payment method.` - `Failed to make payment: *error-description*.` - `Transaction not returned from payment attempt.` - `This Credit Card already exists—Policy Violation" (eradicate the newly created but failed one or ensure it is set INACTIVE).` You receive this error message when you have the Credit\_Card\_Constraints merchant option enabled on your site. This message means that someone is attempting to use a credit card that is already being used as the payment method on an existing account. This is not allowed. |
| `405` | `Payment transaction failed - payment not applied.` |
| `406` | `Specified Account could not be found - payment not applied.` |
| `407` | `Specified PaymentMethod could not be found - payment not applied.` |

## Example

```

$acct = new Account();
$acct->setMerchantAccountId('xyz123');

$paymentMethod = new PaymentMethod();
$paymentMethod->setType('CreditCard');
$paymentMethod->setAccountHolderName('Jane Doe');
$paymentMethod->setCustomerSpecifiedType('Visa');
$paymentMethod->setCurrency('USD');
$paymentMethod->setActive(true);

$cc = new CreditCard();
$cc->setAccount('411111111111111');
$cc->setExpirationDate('201208');
$paymentMethod->setCreditCard($cc);

$response = $acct->makePayment(
   $paymentMethod,
   200,
   'USD',
   'inv-charles',
   null,
   '200 bucks for Charles'
);

// check $response
```

**Parent topic:**[Account Methods](../topics/Account_Methods)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.