Paypal Vault Stored Credit Card
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Getting exception "Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/payment" when trying to payment using stored credit card using vault my code is :
function pay_direct_with_credit_card($credit_card_params, $currency, $amount_total, $my_items, $payment_desc) {
$card = new CreditCard();
$card->setType($credit_card_params['type']);
$card->setNumber($credit_card_params['number']);
$card->setExpireMonth($credit_card_params['expire_month']);
$card->setExpireYear($credit_card_params['expire_year']);
$card->setCvv2($credit_card_params['cvv2']);
$card->setFirstName($credit_card_params['first_name']);
$card->setLastName($credit_card_params['last_name']);
$creditCardToken = new CreditCardToken();
$creditCardToken->setCreditCardId('CARD-0HT79882358410326K5ITCDY');
//print_r( $creditCardToken->setCreditCardId('CARD-0HT79882358410326K5ITCDY') ); die;
$funding_instrument = new FundingInstrument();
$funding_instrument->setCreditCard($creditCardToken);
$payer = new Payer();
$payer->setPaymentMethod("credit_card");
$payer->setFundingInstruments(array($funding_instrument));
$amount = new Amount();
$amount->setCurrency($currency);
$amount->setTotal($amount_total);
$items = new ItemList();
$items->setItems($my_items);
$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setDescription("creating a direct payment with credit card");
$transaction->setItemList($items);
$payment = new Payment();
$payment->setIntent("sale");
$payment->setPayer($payer);
$payment->setTransactions(array($transaction));
$payment->create(apiContext());
return $payment;
}

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Promotional Purchases - refund strategy and exploting the customer in About Payments (Archive)
- Pay over maximum paypal allowance. in About Payments (Archive)
- PayPal Balance on Websites in About Payments (Archive)
- Paypal Confirmed my bank account without deposits in About Payments (Archive)
- PayPal credit in About Payments (Archive)