Direct Credit Card Payment (payPal) From https://devtools-paypal.com/guide/pay_creditcard/php?interactive=ON&env=sandbox
{"scope":"https://uri.paypal.com/services/subscriptions https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card https://uri.paypal.com/services/applications/webhooks openid https://uri.paypal.com/payments/payouts https://api.paypal.com/v1/vault/credit-card/.*","nonce":"2015-12-08T10:56:50ZD4oIFP1D7OkP6V9GAmX9v4AKowp9EWtE1U8k1VENf0I","access_token":"A101.AQIip5Ba3GcmHPwjuO5L3mXLXDjstJQwDVRHbuMACHF7bBrasfvQrnMRVxGQv-Ba.V15-eEZ_s78OcaWmF8tWio_5Axe","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":32341}
{"id":"PAY-3ED68815DM4982139KZTLPOI","create_time":"2015-12-08T10:58:01Z","update_time":"2015-12-08T10:58:06Z","state":"approved","intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":[{"credit_card":{"type":"visa","number":"xxxxxxxxxxxx7004","expire_month":"11","expire_year":"2018","first_name":"Joe","last_name":"Shopper"}}]},"transactions":[{"amount":{"total":"12.00","currency":"USD","details":{"subtotal":"12.00"}},"description":"creating a direct payment with credit card","related_resources":[{"sale":{"id":"6BU51548U2704721F","create_time":"2015-12-08T10:58:01Z","update_time":"2015-12-08T10:58:06Z","amount":{"total":"12.00","currency":"USD"},"state":"completed","parent_payment":"PAY-3ED68815DM4982139KZTLPOI","links":[{"href":"https://api.sandbox.paypal.com/v1/payments/sale/6BU51548U2704721F","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/payments/sale/6BU51548U2704721F/refund","rel":"refund","method":"POST"},{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-3ED68815DM4982139KZTLPOI","rel":"parent_payment","method":"GET"}],"fmf_details":{},"processor_response":{"avs_code":"X","cvv_code":"M"}}}]}],"links":[{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-3ED68815DM4982139KZTLPOI","rel":"self","method":"GET"}]}
$sdkConfig = array(
"mode" => "sandbox"
);
$cred = "Bearer A101.AQIip5Ba3GcmHPwjuO5L3mXLXDjstJQwDVRHbuMACHF7bBrasfvQrnMRVxGQv-Ba.V15-eEZ_s78OcaWmF8tWio_5Axe";
$apiContext = new ApiContext($cred, 'Request' . time());
$apiContext->setConfig($sdkConfig);
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4446283280247004");
$card->setExpire_month("11");
$card->setExpire_year("2018");
$card->setFirst_name("Joe");
$card->setLast_name("Shopper");
$fundingInstrument = new FundingInstrument();
$fundingInstrument->setCredit_card($card);
$payer = new Payer();
$payer->setPayment_method("credit_card");
$payer->setFunding_instruments(array($fundingInstrument));
$amount = new Amount();
$amount->setCurrency("USD");
$amount->setTotal("12");
$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setDescription("creating a direct payment with credit card");
$payment = new Payment();
$payment->setIntent("sale");
$payment->setPayer($payer);
$payment->setTransactions(array($transaction));
$payment->create($apiContext);
Payment Completed for Payment Id: PAY-3ED68815DM4982139KZTLPOI
Payment Status: approved
$sdkConfig = array(
"mode" => "sandbox"
);
$cred = new OAuthTokenCredential("AaiXFpAJ0YJVvdssdIFs2ZO_fv6yIQefmPOwErCywQdfFrCieNfdFBFaHBsPT--1bGuJ2rzrp_fIB4Fw","EAoREgkbc_FfLXanzE5SVt93xgHkXFWKwzR0_oETxlgDXYtr0Ro8XWtztCdqalrgmUPJyCn24O_nVODo", $sdkConfig);https://api.sandbox.paypal.com/v1/oauth2/tokenauthrestauthapplication/jsonclient_credentials