forked from LiveCarta/PayPal-PHP-SDK
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user