More Vault API Samples

- Updated Samples for Vault APIs
- Updated Payment Execute to be more verbose
- Delete Plan Sample Update
- Fixes #168
This commit is contained in:
japatel
2014-12-01 16:52:44 -06:00
parent ff5588bbfe
commit 6cf15ab4bf
22 changed files with 527 additions and 60 deletions

View File

@@ -15,10 +15,10 @@ use PayPal\Api\Plan;
try {
$result = $createdPlan->delete($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Deleted a Plan", "Plan", $plan->getId(), null, $ex);
ResultPrinter::printError("Deleted a Plan", "Plan", $createdPlan->getId(), null, $ex);
exit(1);
}
ResultPrinter::printResult("Deleted a Plan", "Plan", $plan->getId(), null, null);
ResultPrinter::printResult("Deleted a Plan", "Plan", $createdPlan->getId(), null, null);
return $plan;
return $createdPlan;

View File

@@ -1,14 +1,19 @@
<?php
// #Execute Agreement
// This is the second part of CreateAgreement Sample.
// Use this call to execute an agreement after the buyer approves it
require __DIR__ . '/../bootstrap.php';
session_start();
// ## Approval Status
// Determine if the user accepted or denied the request
if (isset($_GET['success']) && $_GET['success'] == 'true') {
$token = $_GET['token'];
$agreement = new \PayPal\Api\Agreement();
try {
// ## Execute Agreement
// Execute the agreement by passing in the token
$agreement->execute($token, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Executed an Agreement", "Agreement", $agreement->getId(), $_GET['token'], $ex);