src/models/Invoice.php
public function pay($amount, $parameters) {
        $payment = new InvoicePayment();
        $payment->amount = $amount;

        $payment->setPreCommitMetadataArray($parameters['metadata']);

        $payment->invoice()->associate($this);
        $payment->type()->associate($parameters['type']);

        if(isset($parameters['id'])) {
            $payment->payment_id = $parameters['id'];
        }

        $payment->save();
        return $payment;
    }
public function pay($amount, $parameters) {
        $payment = new InvoicePayment();
        $payment->amount = $amount;

        $payment->setPreCommitMetadataArray($parameters['metadata']);

        $payment->invoice()->associate($this);
        $payment->type()->associate($parameters['type']);

        if(isset($parameters['id'])) {
            $payment->payment_id = $parameters['id'];
        }

        $payment->save();
        return $payment;
    }
public function pay ( $ amount , $ parameters ) { $ payment = new InvoicePayment ( ) ; $ payment -> amount = $ amount ; $ payment -> setPreCommitMetadataArray ( $ parameters [ 'metadata' ] ) ; $ payment -> invoice ( ) -> associate ( $ this ) ; $ payment -> type ( ) -> associate ( $ parameters [ 'type' ] ) ; if ( isset ( $ parameters [ 'id' ] ) ) { $ payment -> payment_id = $ parameters [ 'id' ] ; } $ payment -> save ( ) ; return $ payment ; }
Apply a payment to this invoice.

@param $amount
@param $parameters String[][] Key/value array: type => PaymentType, id => string
@return InvoicePayment Return the invoice payment made.
Apply a payment to this invoice .