This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proper changes to samples for Credit Card
- Loading branch information
mrak and sdcoffey
committed
Oct 25, 2016
1 parent
7b380a1
commit 7c5ea8b
Showing
7 changed files
with
14 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,10 @@ | |
$createdPlan = require 'UpdatePlan.php'; | ||
|
||
use PayPal\Api\Agreement; | ||
use PayPal\Api\CreditCard; | ||
use PayPal\Api\FundingInstrument; | ||
use PayPal\Api\Payer; | ||
use PayPal\Api\PayerInfo; | ||
use PayPal\Api\PaymentCard; | ||
use PayPal\Api\Plan; | ||
use PayPal\Api\ShippingAddress; | ||
|
||
|
@@ -70,15 +70,15 @@ | |
->setPayerInfo(new PayerInfo(array('email' => '[email protected]'))); | ||
|
||
// Add Credit Card to Funding Instruments | ||
$paymentCard = new PaymentCard(); | ||
$paymentCard->setType('visa') | ||
$card = new CreditCard(); | ||
$card->setType('visa') | ||
->setNumber('4491759698858890') | ||
->setExpireMonth('12') | ||
->setExpireYear('2017') | ||
->setCvv2('128'); | ||
|
||
$fundingInstrument = new FundingInstrument(); | ||
$fundingInstrument->setPaymentCard($paymentCard); | ||
$fundingInstrument->setCreditCard($card); | ||
$payer->setFundingInstruments(array($fundingInstrument)); | ||
//Add Payer to Agreement | ||
$agreement->setPayer($payer); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
<span class="hljs-variable">$createdPlan</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'UpdatePlan.php'</span>; | ||
|
||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Agreement</span>; | ||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCard</span>; | ||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">FundingInstrument</span>; | ||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payer</span>; | ||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PayerInfo</span>; | ||
|
@@ -55,15 +56,15 @@ | |
<span class="hljs-variable">$plan</span>->setId(<span class="hljs-variable">$createdPlan</span>->getId()); | ||
<span class="hljs-variable">$agreement</span>->setPlan(<span class="hljs-variable">$plan</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payer</span> = <span class="hljs-keyword">new</span> Payer(); | ||
<span class="hljs-variable">$payer</span>->setPaymentMethod(<span class="hljs-string">'credit_card'</span>) | ||
->setPayerInfo(<span class="hljs-keyword">new</span> PayerInfo(<span class="hljs-keyword">array</span>(<span class="hljs-string">'email'</span> => <span class="hljs-string">'[email protected]'</span>)));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Credit Card to Funding Instruments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$paymentCard</span> = <span class="hljs-keyword">new</span> PaymentCard(); | ||
<span class="hljs-variable">$paymentCard</span>->setType(<span class="hljs-string">'visa'</span>) | ||
->setPayerInfo(<span class="hljs-keyword">new</span> PayerInfo(<span class="hljs-keyword">array</span>(<span class="hljs-string">'email'</span> => <span class="hljs-string">'[email protected]'</span>)));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Credit Card to Funding Instruments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$card</span> = <span class="hljs-keyword">new</span> CreditCard(); | ||
<span class="hljs-variable">$card</span>->setType(<span class="hljs-string">'visa'</span>) | ||
->setNumber(<span class="hljs-string">'4491759698858890'</span>) | ||
->setExpireMonth(<span class="hljs-string">'12'</span>) | ||
->setExpireYear(<span class="hljs-string">'2017'</span>) | ||
->setCvv2(<span class="hljs-string">'128'</span>); | ||
|
||
<span class="hljs-variable">$fundingInstrument</span> = <span class="hljs-keyword">new</span> FundingInstrument(); | ||
<span class="hljs-variable">$fundingInstrument</span>->setPaymentCard(<span class="hljs-variable">$paymentCard</span>); | ||
<span class="hljs-variable">$fundingInstrument</span>->setCreditCard(<span class="hljs-variable">$card</span>); | ||
<span class="hljs-variable">$payer</span>->setFundingInstruments(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$fundingInstrument</span>)); | ||
<span class="hljs-comment">//Add Payer to Agreement</span> | ||
<span class="hljs-variable">$agreement</span>->setPayer(<span class="hljs-variable">$payer</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Shipping Address</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$shippingAddress</span> = <span class="hljs-keyword">new</span> ShippingAddress(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters