PayPal\Api\CreditCard::setExpireMonth PHP Method

setExpireMonth() public method

Expiration month with no leading zero. Acceptable values are 1 through 12.
public setExpireMonth ( integer $expire_month )
$expire_month integer
    public function setExpireMonth($expire_month)
    {
        $this->expire_month = $expire_month;
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Runs a card payment with PayPal
  *
  * @link https://devtools-paypal.com/guide/pay_creditcard/php?interactive=ON&env=sandbox
  * @return PayPal\Api\Payment 
  */
 public function payCard($cardInfo = [], $sum = 0, $message = '')
 {
     $card = new CreditCard();
     $card->setType($cardInfo['cardType']);
     $card->setNumber($cardInfo['cardNumber']);
     $card->setExpireMonth($cardInfo['expMonth']);
     $card->setExpireYear($cardInfo['expYear']);
     $card->setFirstName($cardInfo['firstName']);
     $card->setLastName($cardInfo['lastName']);
     $fundingInstrument = new FundingInstrument();
     $fundingInstrument->setCreditCard($card);
     $payer = new Payer();
     $payer->setPaymentMethod('credit_card');
     $payer->setFundingInstruments(array($fundingInstrument));
     $amount = new Amount();
     $amount->setCurrency($this->currency);
     $amount->setTotal($sum);
     $transaction = new Transaction();
     $transaction->setAmount($amount);
     if ($message) {
         $transaction->setDescription($message);
     }
     $payment = new Payment();
     $payment->setIntent('sale');
     $payment->setPayer($payer);
     $payment->setTransactions(array($transaction));
     return $payment->create($this->_apiContext);
     // get state from this json
 }
All Usage Examples Of PayPal\Api\CreditCard::setExpireMonth