/**
* 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
}