From 2b965b059673c961b324ec15ba9f9f2b83d78894 Mon Sep 17 00:00:00 2001 From: Ganesh Hegde <1ganesh1@facebook.com> Date: Wed, 29 May 2013 17:23:47 +0530 Subject: [PATCH] updating sample to show full API flow --- sample/payments/AuthorizationCapture.php | 74 ++++++++++++++++--- sample/payments/GetAuthorization.php | 59 +++++++++++++++- sample/payments/GetCapture.php | 82 ++++++++++++++++++++- sample/payments/RefundCapture.php | 90 ++++++++++++++++++++++-- sample/payments/VoidAuthorization.php | 59 +++++++++++++++- sample/vault/DeleteCreditCard.php | 31 +++++++- 6 files changed, 374 insertions(+), 21 deletions(-) diff --git a/sample/payments/AuthorizationCapture.php b/sample/payments/AuthorizationCapture.php index 328b518..d87474a 100644 --- a/sample/payments/AuthorizationCapture.php +++ b/sample/payments/AuthorizationCapture.php @@ -6,23 +6,28 @@ require __DIR__ . '/../bootstrap.php'; use PayPal\Api\Capture; use PayPal\Api\Authorization; +use PayPal\Api\Address; use PayPal\Api\Amount; +use PayPal\Api\CreditCard; +use PayPal\Api\Payer; +use PayPal\Api\Payment; +use PayPal\Api\FundingInstrument; +use PayPal\Api\Transaction; -### Amount -//Let's you specify a payment amount. - $amount = new Amount(); - $amount->setCurrency("USD"); - $amount->setTotal("1.00"); +// create payment to get authorization Id +$authId = createAuthorization(); +$amt = new Amount(); +$amt->setCurrency("USD"); +$amt->setTotal("1.00"); ### Capture - $captur = new Capture(); -$captur->setId('5RA45624N3531924N'); -$captur->setAmount($amount); +$captur->setId($authId); +$captur->setAmount($amt); // get the authorization -$authorization = Authorization::get('8UA90289RG279654G', $apiContext); +$authorization = Authorization::get($authId, $apiContext); // ### Capture Payment // Capture Payment by posting to the APIService @@ -42,7 +47,56 @@ try { Capture payment: getId();?> -
toArray());?>+
+ toArray());?> +Back