src/Controllers/AccountBillingController.php
public function makeCreditCardPayment($accountID, CreditCard $creditCard, $amount, $saveAndMakeAuto = false)
    {
        $result = $this->httpHelper->post("/accounts/" . intval($accountID) . "/transactions/one_time_credit_card_payment", [
            'number' => $creditCard->getNumber(),
            'expiration_month' => $creditCard->getExpirationMonth(),
            'expiration_year' => $creditCard->getExpirationYear(),
            'amount' => trim($amount),
            'name_on_account' => $creditCard->getName(),
            'line1' => $creditCard->getLine1(),
            'city' => $creditCard->getCity(),
            'state' => $creditCard->getState(),
            'zip' => $creditCard->getZip(),
            'country' => $creditCard->getCountry(),
            'cvc' => $creditCard->getCvc(),
        ]);

        if ($result->success === true && $saveAndMakeAuto === true)
        {
            try {
                $this->createCreditCard($accountID, $creditCard);
            }
            catch (Exception $e)
            {
                //Not much we can do here, the payment has already been run. Very unlikely payment will work and saving will fail.
            }
        }
        unset($creditCard);

        return $result;
    }
public function makeCreditCardPayment($accountID, CreditCard $creditCard, $amount, $saveAndMakeAuto = false)
    {
        $result = $this->httpHelper->post("/accounts/" . intval($accountID) . "/transactions/one_time_credit_card_payment", [
            'number' => $creditCard->getNumber(),
            'expiration_month' => $creditCard->getExpirationMonth(),
            'expiration_year' => $creditCard->getExpirationYear(),
            'amount' => trim($amount),
            'name_on_account' => $creditCard->getName(),
            'line1' => $creditCard->getLine1(),
            'city' => $creditCard->getCity(),
            'state' => $creditCard->getState(),
            'zip' => $creditCard->getZip(),
            'country' => $creditCard->getCountry(),
            'cvc' => $creditCard->getCvc(),
        ]);

        if ($result->success === true && $saveAndMakeAuto === true)
        {
            try {
                $this->createCreditCard($accountID, $creditCard);
            }
            catch (Exception $e)
            {
                //Not much we can do here, the payment has already been run. Very unlikely payment will work and saving will fail.
            }
        }
        unset($creditCard);

        return $result;
    }
public function makeCreditCardPayment ( $ accountID , CreditCard $ creditCard , $ amount , $ saveAndMakeAuto = false ) { $ result = $ this -> httpHelper -> post ( "/accounts/" . intval ( $ accountID ) . "/transactions/one_time_credit_card_payment" , [ 'number' => $ creditCard -> getNumber ( ) , 'expiration_month' => $ creditCard -> getExpirationMonth ( ) , 'expiration_year' => $ creditCard -> getExpirationYear ( ) , 'amount' => trim ( $ amount ) , 'name_on_account' => $ creditCard -> getName ( ) , 'line1' => $ creditCard -> getLine1 ( ) , 'city' => $ creditCard -> getCity ( ) , 'state' => $ creditCard -> getState ( ) , 'zip' => $ creditCard -> getZip ( ) , 'country' => $ creditCard -> getCountry ( ) , 'cvc' => $ creditCard -> getCvc ( ) , ] ) ; if ( $ result -> success === true && $ saveAndMakeAuto === true ) { try { $ this -> createCreditCard ( $ accountID , $ creditCard ) ; } catch ( Exception $ e ) { //Not much we can do here, the payment has already been run. Very unlikely payment will work and saving will fail. } } unset ( $ creditCard ) ; return $ result ; }
Make a one time payment with a credit card and, optionally, save it as a future automatic payment method. This should not be used to pay with an existing payment method.
@param $accountID - The account ID in Sonar
@param CreditCard $creditCard - A CreditCard object
@param $amount - The amount in the currency used in Sonar as a float
@param bool $saveAndMakeAuto - If this is true, save the card if it successfully runs
@return mixed
@throws ApiException
Make a one time payment with a credit card and optionally save it as a future automatic payment method . This should not be used to pay with an existing payment method .