setLine1("3909 Witmer Road") ->setLine2("Niagara Falls") ->setCity("Niagara Falls") ->setState("NY") ->setPostalCode("14305") ->setCountryCode("US") ->setPhone("716-298-1822"); $card = new CreditCard(); $card->setType("visa") ->setNumber("4417119669820331") ->setExpireMonth("11") ->setExpireYear("2019") ->setCvv2("012") ->setFirstName("Joe") ->setLastName("Shopper") ->setBillingAddress($addr); $fi = new FundingInstrument(); $fi->setCreditCard($card); $payer = new Payer(); $payer->setPaymentMethod("credit_card") ->setFundingInstruments(array($fi)); $amount = new Amount(); $amount->setCurrency("USD") ->setTotal("1.00"); $transaction = new Transaction(); $transaction->setAmount($amount) ->setDescription("This is the payment description."); $payment = new Payment(); // Setting intent to authorize creates a payment // authorization. Setting it to sale makes an actual payment $payment->setIntent("authorize") ->setPayer($payer) ->setTransactions(array($transaction)); $paymnt = $payment->create($apiContext); $resArray = $paymnt->toArray(); return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id']; }