From 2929f63859c338e37359244c43030c9f2ca21137 Mon Sep 17 00:00:00 2001 From: Jay Patel Date: Mon, 20 Jul 2015 11:33:47 -0500 Subject: [PATCH] Adding Execute Step to Authorize Payment Sample - Additional Formatting Updates --- sample/doc/assets/behavior.js | 48 +------------------ .../CreateBillingAgreementWithCreditCard.html | 8 ++-- .../CreateBillingAgreementWithPayPal.html | 2 +- sample/doc/billing/CreatePlan.html | 8 ++-- .../doc/billing/UpdateBillingAgreement.html | 2 +- sample/doc/billing/UpdatePlan.html | 5 +- .../billing/UpdatePlanPaymentDefinitions.html | 4 +- sample/doc/invoice/CancelInvoice.html | 2 +- sample/doc/invoice/CreateInvoice.html | 16 +++---- sample/doc/invoice/DeleteInvoice.html | 1 - sample/doc/invoice/RetrieveQRCode.html | 1 - sample/doc/lipp/GetUserInfo.html | 13 ++--- .../notifications/SearchWebhookEvents.html | 1 - sample/doc/payments/AuthorizationCapture.html | 4 +- sample/doc/payments/AuthorizePayment.html | 6 +-- sample/doc/payments/CreateFuturePayment.html | 3 +- sample/doc/payments/CreatePayment.html | 4 +- .../payments/CreatePaymentUsingSavedCard.html | 8 ++-- sample/doc/payments/GetAuthorization.html | 3 +- sample/doc/payments/GetCapture.html | 4 +- sample/doc/payments/OrderAuthorize.html | 1 - sample/doc/payments/OrderCapture.html | 4 +- sample/doc/payments/OrderDoVoid.html | 5 +- sample/doc/payments/Reauthorization.html | 4 +- sample/doc/payments/RefundCapture.html | 4 +- sample/doc/sale/GetSale.html | 4 +- sample/index.php | 15 +++--- 27 files changed, 60 insertions(+), 120 deletions(-) diff --git a/sample/doc/assets/behavior.js b/sample/doc/assets/behavior.js index 2e339d9..ec4deaa 100644 --- a/sample/doc/assets/behavior.js +++ b/sample/doc/assets/behavior.js @@ -490,53 +490,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "invoice/UpdateInvoice", "title": "UpdateInvoice" }, - "depth": 2, - "outline": [ - { - "type": "heading", - "data": { - "level": 1, - "title": "Update Invoice Sample", - "slug": "update-invoice-sample" - }, - "depth": 1, - "children": [ - { - "type": "heading", - "data": { - "level": 3, - "title": "Update Invoice", - "slug": "update-invoice" - }, - "depth": 3 - }, { - "type": "heading", - "data": { - "level": 3, - "title": "NOTE: These are the work-around added to the", - "slug": "note-these-are-the-work-around-added-to-the" - }, - "depth": 3 - }, { - "type": "heading", - "data": { - "level": 3, - "title": "Update Invoice", - "slug": "update-invoice" - }, - "depth": 3 - }, { - "type": "heading", - "data": { - "level": 3, - "title": "Retrieve Invoice", - "slug": "retrieve-invoice" - }, - "depth": 3 - } - ] - } - ] + "depth": 2 } ] }, { diff --git a/sample/doc/billing/CreateBillingAgreementWithCreditCard.html b/sample/doc/billing/CreateBillingAgreementWithCreditCard.html index 8db7105..69cf112 100644 --- a/sample/doc/billing/CreateBillingAgreementWithCreditCard.html +++ b/sample/doc/billing/CreateBillingAgreementWithCreditCard.html @@ -6,12 +6,12 @@ define Plan information to create an agreement. Make sure the plan you are using $createdPlan = require 'UpdatePlan.php'; use PayPal\Api\Agreement; -use PayPal\Api\Plan; -use PayPal\Api\Payer; -use PayPal\Api\ShippingAddress; -use PayPal\Api\PayerInfo; use PayPal\Api\CreditCard; use PayPal\Api\FundingInstrument; +use PayPal\Api\Payer; +use PayPal\Api\PayerInfo; +use PayPal\Api\Plan; +use PayPal\Api\ShippingAddress; /* Create a new instance of Agreement object { diff --git a/sample/doc/billing/CreateBillingAgreementWithPayPal.html b/sample/doc/billing/CreateBillingAgreementWithPayPal.html index 82ece0c..5d63ee0 100644 --- a/sample/doc/billing/CreateBillingAgreementWithPayPal.html +++ b/sample/doc/billing/CreateBillingAgreementWithPayPal.html @@ -6,8 +6,8 @@ define Plan information to create an agreement. Make sure the plan you are using $createdPlan = require 'UpdatePlan.php'; use PayPal\Api\Agreement; -use PayPal\Api\Plan; use PayPal\Api\Payer; +use PayPal\Api\Plan; use PayPal\Api\ShippingAddress; /* Create a new instance of Agreement object diff --git a/sample/doc/billing/CreatePlan.html b/sample/doc/billing/CreatePlan.html index 69b9ec8..e16f062 100644 --- a/sample/doc/billing/CreatePlan.html +++ b/sample/doc/billing/CreatePlan.html @@ -2,11 +2,11 @@

This sample code demonstrate how you can create a billing plan, as documented here at: https://developer.paypal.com/webapps/developer/docs/api/#create-a-plan API used: /v1/payments/billing-plans

require __DIR__ . '/../bootstrap.php'; -use PayPal\Api\Plan; -use PayPal\Api\PaymentDefinition; -use PayPal\Api\MerchantPreferences; +use PayPal\Api\ChargeModel; use PayPal\Api\Currency; -use PayPal\Api\ChargeModel;

Create a new instance of Plan object

$plan = new Plan();

Basic Information

+use PayPal\Api\MerchantPreferences; +use PayPal\Api\PaymentDefinition; +use PayPal\Api\Plan;

Create a new instance of Plan object

$plan = new Plan();

Basic Information

Fill up the basic information that is required for the plan

$plan->setName('T-Shirt of the Month Club Plan') ->setDescription('Template creation.') ->setType('fixed');

Payment definitions for this billing plan.

$paymentDefinition = new PaymentDefinition();

The possible values for such setters are mentioned in the setter method documentation. diff --git a/sample/doc/billing/UpdateBillingAgreement.html b/sample/doc/billing/UpdateBillingAgreement.html index ff42c07..b994665 100644 --- a/sample/doc/billing/UpdateBillingAgreement.html +++ b/sample/doc/billing/UpdateBillingAgreement.html @@ -5,8 +5,8 @@ API used: /v1/payments/billing-agreements/

$createdAgreement
= require 'CreateBillingAgreementWithCreditCard.php'; use PayPal\Api\Agreement; -use PayPal\Api\PatchRequest; use PayPal\Api\Patch; +use PayPal\Api\PatchRequest; $patch = new Patch(); diff --git a/sample/doc/billing/UpdatePlan.html b/sample/doc/billing/UpdatePlan.html index 8ef91be..f009dde 100644 --- a/sample/doc/billing/UpdatePlan.html +++ b/sample/doc/billing/UpdatePlan.html @@ -5,10 +5,11 @@ API used: /v1/payments/billing-plans/

This example demonstrate how you could activate the Plan.

Retrieving the Plan object from Create Plan Sample to demonstrate the List

/** @var Plan $createdPlan */ $createdPlan = require 'CreatePlan.php'; -use PayPal\Api\Plan; -use PayPal\Api\PatchRequest; use PayPal\Api\Patch; +use PayPal\Api\PatchRequest; +use PayPal\Api\Plan; use PayPal\Common\PayPalModel; + try { $patch = new Patch(); diff --git a/sample/doc/billing/UpdatePlanPaymentDefinitions.html b/sample/doc/billing/UpdatePlanPaymentDefinitions.html index 450f97b..54c5790 100644 --- a/sample/doc/billing/UpdatePlanPaymentDefinitions.html +++ b/sample/doc/billing/UpdatePlanPaymentDefinitions.html @@ -5,9 +5,9 @@ API used: /v1/payments/billing-plans/

This example demonstrate how you could change the plan amount

Retrieving the Plan object from Create Plan Sample to demonstrate the List

/** @var Plan $createdPlan */ $createdPlan = require 'CreatePlan.php'; -use PayPal\Api\Plan; -use PayPal\Api\PatchRequest; use PayPal\Api\Patch; +use PayPal\Api\PatchRequest; +use PayPal\Api\Plan; try { $patch = new Patch(); diff --git a/sample/doc/invoice/CancelInvoice.html b/sample/doc/invoice/CancelInvoice.html index af10410..aa2027e 100644 --- a/sample/doc/invoice/CancelInvoice.html +++ b/sample/doc/invoice/CancelInvoice.html @@ -3,8 +3,8 @@ an invoice.

/** @var Invoice $invoice */ $invoice = require 'SendInvoice.php'; -use PayPal\Api\Invoice; use PayPal\Api\CancelNotification; +use PayPal\Api\Invoice; try {

Cancel Notification Object

This would send a notification to both merchant as well diff --git a/sample/doc/invoice/CreateInvoice.html b/sample/doc/invoice/CreateInvoice.html index 4329dd0..d86432d 100644 --- a/sample/doc/invoice/CreateInvoice.html +++ b/sample/doc/invoice/CreateInvoice.html @@ -1,17 +1,17 @@ invoice/CreateInvoice

invoice/CreateInvoice.php
<?php

Create Invoice Sample

This sample code demonstrate how you can create an invoice.

require __DIR__ . '/../bootstrap.php'; -use PayPal\Api\Cost; -use PayPal\Api\Invoice; -use PayPal\Api\MerchantInfo; -use PayPal\Api\BillingInfo; -use PayPal\Api\InvoiceItem; -use PayPal\Api\Phone; use PayPal\Api\Address; +use PayPal\Api\BillingInfo; +use PayPal\Api\Cost; use PayPal\Api\Currency; -use PayPal\Api\PaymentTerm; -use PayPal\Api\ShippingInfo; +use PayPal\Api\Invoice; use PayPal\Api\InvoiceAddress; +use PayPal\Api\InvoiceItem; +use PayPal\Api\MerchantInfo; +use PayPal\Api\PaymentTerm; +use PayPal\Api\Phone; +use PayPal\Api\ShippingInfo; $invoice = new Invoice();

Invoice Info

Fill in all the information that is diff --git a/sample/doc/invoice/DeleteInvoice.html b/sample/doc/invoice/DeleteInvoice.html index a5f72d7..7e0d6c2 100644 --- a/sample/doc/invoice/DeleteInvoice.html +++ b/sample/doc/invoice/DeleteInvoice.html @@ -4,7 +4,6 @@ an invoice.

$invoice = require 'CreateInvoice.php'; use PayPal\Api\Invoice; -use PayPal\Api\CancelNotification; try {

Delete Invoice

Delete invoice object by calling the diff --git a/sample/doc/invoice/RetrieveQRCode.html b/sample/doc/invoice/RetrieveQRCode.html index f1e982b..fb824d7 100644 --- a/sample/doc/invoice/RetrieveQRCode.html +++ b/sample/doc/invoice/RetrieveQRCode.html @@ -3,7 +3,6 @@ $invoice = require 'SendInvoice.php'; use PayPal\Api\Invoice; -use PayPal\Api\Notification; try {

Retrieve QR Code of Sent Invoice

Retrieve QR Code of Sent Invoice by calling the diff --git a/sample/doc/lipp/GetUserInfo.html b/sample/doc/lipp/GetUserInfo.html index a7b717a..86b5ba1 100644 --- a/sample/doc/lipp/GetUserInfo.html +++ b/sample/doc/lipp/GetUserInfo.html @@ -1,7 +1,7 @@ lipp/GetUserInfo

lipp/GetUserInfo.php
<?php

Obtain Access Token From Refresh Token

require __DIR__ . '/../bootstrap.php'; -use PayPal\Api\OpenIdUserinfo; -use PayPal\Api\OpenIdTokeninfo;

To obtain User Info, you have to follow three steps in general. +use PayPal\Api\OpenIdTokeninfo; +use PayPal\Api\OpenIdUserinfo;

To obtain User Info, you have to follow three steps in general. First, you need to obtain user's consent to retrieve the information you want. This is explained in the example "ObtainUserConsent.php".

Once you get the user's consent, the end result would be long lived refresh token. This refresh token should be stored in a permanent storage for later use.

Lastly, when you need to retrieve the user information, you need to generate the short lived access token @@ -16,11 +16,6 @@ to retreive the information. The short lived access token can be retrieved using $params = array('access_token' => $tokenInfo->getAccessToken()); $userInfo = OpenIdUserinfo::getUserinfo($params, $apiContext); -} catch (Exception $ex) { - // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY - ResultPrinter::printError("User Information", "User Info", null, $params, $ex); +} catch (Exception $ex) {

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printError("User Information", "User Info", null, $params, $ex); exit(1); -} - -// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY - ResultPrinter::printResult("User Information", "User Info", $userInfo->getUserId(), $params, $userInfo);
+}

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printResult("User Information", "User Info", $userInfo->getUserId(), $params, $userInfo);
\ No newline at end of file diff --git a/sample/doc/notifications/SearchWebhookEvents.html b/sample/doc/notifications/SearchWebhookEvents.html index 33b2e15..e5d3114 100644 --- a/sample/doc/notifications/SearchWebhookEvents.html +++ b/sample/doc/notifications/SearchWebhookEvents.html @@ -6,7 +6,6 @@ API used: GET /v1/notifications/webhooks-events

Creating webhook is sample purposes only. In real scenario, you dont need to create a new webhook everytime you want to search for a webhook events. This is made in a sample just to make sure there is minimum of one webhook to listen to.

/** @var \PayPal\Api\Webhook $webhook */ $webhook = require __DIR__ . '/../bootstrap.php'; -use PayPal\Api\Authorization; $params = array(

'start_time'=>'2014-12-06T11:00:00Z', 'end_time'=>'2014-12-12T11:00:00Z'

);

Search Webhook events

try { diff --git a/sample/doc/payments/AuthorizationCapture.html b/sample/doc/payments/AuthorizationCapture.html index e924b14..e4faace 100644 --- a/sample/doc/payments/AuthorizationCapture.html +++ b/sample/doc/payments/AuthorizationCapture.html @@ -5,8 +5,8 @@ API used: /v1/payments/payment https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization

/** @var Authorization $authorization */ $authorization = require 'GetAuthorization.php'; use PayPal\Api\Amount; -use PayPal\Api\Capture; -use PayPal\Api\Authorization;

Capture Payment

+use PayPal\Api\Authorization; +use PayPal\Api\Capture;

Capture Payment

You can capture and process a previously created authorization by invoking the $authorization->capture method with a valid ApiContext (See bootstrap.php for more on ApiContext)

try { diff --git a/sample/doc/payments/AuthorizePayment.html b/sample/doc/payments/AuthorizePayment.html index 10f4a43..53e7743 100644 --- a/sample/doc/payments/AuthorizePayment.html +++ b/sample/doc/payments/AuthorizePayment.html @@ -4,12 +4,12 @@ API used: /v1/payments/authorization https://developer.paypal.com/webapps/developer/docs/integration/direct/capture-payment/#authorize-the-payment

require __DIR__ . '/../bootstrap.php'; use PayPal\Api\Address; +use PayPal\Api\Amount; use PayPal\Api\CreditCard; use PayPal\Api\FundingInstrument; use PayPal\Api\Payer; -use PayPal\Api\Amount; -use PayPal\Api\Transaction; -use PayPal\Api\Payment;

The biggest difference between creating a payment, and authorizing a payment is to set the intent of payment +use PayPal\Api\Payment; +use PayPal\Api\Transaction;

The biggest difference between creating a payment, and authorizing a payment is to set the intent of payment to correct setting. In this case, it would be 'authorize'

$addr = new Address(); $addr->setLine1("3909 Witmer Road") ->setLine2("Niagara Falls") diff --git a/sample/doc/payments/CreateFuturePayment.html b/sample/doc/payments/CreateFuturePayment.html index 14f6101..75f33bb 100644 --- a/sample/doc/payments/CreateFuturePayment.html +++ b/sample/doc/payments/CreateFuturePayment.html @@ -3,10 +3,11 @@ PayPal Account based Payment. API used: /v1/payments/payment

require __DIR__ . '/../bootstrap.php'; use PayPal\Api\Amount; -use PayPal\Api\Payer; use PayPal\Api\FuturePayment; +use PayPal\Api\Payer; use PayPal\Api\RedirectUrls; use PayPal\Api\Transaction; + session_start();

Payer

A resource representing a Payer that funds a payment For paypal account payments, set payment method diff --git a/sample/doc/payments/CreatePayment.html b/sample/doc/payments/CreatePayment.html index 4fdec3f..7dd7f65 100644 --- a/sample/doc/payments/CreatePayment.html +++ b/sample/doc/payments/CreatePayment.html @@ -5,13 +5,13 @@ credit card payment and related features using the REST API is restricted in some countries. API used: /v1/payments/payment

require __DIR__ . '/../bootstrap.php'; use PayPal\Api\Amount; +use PayPal\Api\CreditCard; use PayPal\Api\Details; +use PayPal\Api\FundingInstrument; use PayPal\Api\Item; use PayPal\Api\ItemList; -use PayPal\Api\CreditCard; use PayPal\Api\Payer; use PayPal\Api\Payment; -use PayPal\Api\FundingInstrument; use PayPal\Api\Transaction;

CreditCard

A resource representing a credit card that can be used to fund a payment.

$card = new CreditCard(); diff --git a/sample/doc/payments/CreatePaymentUsingSavedCard.html b/sample/doc/payments/CreatePaymentUsingSavedCard.html index d04a7f3..c1ffbfe 100644 --- a/sample/doc/payments/CreatePaymentUsingSavedCard.html +++ b/sample/doc/payments/CreatePaymentUsingSavedCard.html @@ -4,15 +4,15 @@ Payment using a previously stored credit card token. API used: /v1/payments/payment

/** @var CreditCard $card */ $card = require __DIR__ . '/../vault/CreateCreditCard.php'; use PayPal\Api\Amount; +use PayPal\Api\CreditCard; +use PayPal\Api\CreditCardToken; use PayPal\Api\Details; +use PayPal\Api\FundingInstrument; use PayPal\Api\Item; use PayPal\Api\ItemList; -use PayPal\Api\CreditCardToken; use PayPal\Api\Payer; use PayPal\Api\Payment; -use PayPal\Api\FundingInstrument; -use PayPal\Api\Transaction; -use PayPal\Api\CreditCard;

Credit card token

+use PayPal\Api\Transaction;

Credit card token

Saved credit card id from a previous call to CreateCreditCard.php

$creditCardToken = new CreditCardToken(); $creditCardToken->setCreditCardId($card->getId());

FundingInstrument

diff --git a/sample/doc/payments/GetAuthorization.html b/sample/doc/payments/GetAuthorization.html index 26897fb..f0094d1 100644 --- a/sample/doc/payments/GetAuthorization.html +++ b/sample/doc/payments/GetAuthorization.html @@ -4,8 +4,7 @@ of an authorized payment. API used: /v1/payments/authorization/<$authorizationId>

/** @var Authorization $authorization */ $authorization = require 'AuthorizePayment.php'; $authorizationId = $authorization->getId(); -use PayPal\Api\Authorization; -use PayPal\Api\Payment;

GetAuthorization

+use PayPal\Api\Authorization;

GetAuthorization

You can retrieve info about an Authorization by invoking the Authorization::get method with a valid ApiContext (See bootstrap.php for more on ApiContext) diff --git a/sample/doc/payments/GetCapture.html b/sample/doc/payments/GetCapture.html index bdfbc48..8b59257 100644 --- a/sample/doc/payments/GetCapture.html +++ b/sample/doc/payments/GetCapture.html @@ -4,9 +4,7 @@ of a captured payment. API used: /v1/payments/capture/<$captureId>

/** @var Capture $request */ $request = require 'AuthorizationCapture.php'; -use PayPal\Api\Capture; -use PayPal\Api\Amount; -use PayPal\Api\Authorization;

Retrieve Capture details

+use PayPal\Api\Capture;

Retrieve Capture details

You can look up a capture by invoking the Capture::get method with a valid ApiContext (See bootstrap.php for more on ApiContext)

try { $capture = Capture::get($request->getId(), $apiContext); diff --git a/sample/doc/payments/OrderAuthorize.html b/sample/doc/payments/OrderAuthorize.html index 2e0fb32..12d08f1 100644 --- a/sample/doc/payments/OrderAuthorize.html +++ b/sample/doc/payments/OrderAuthorize.html @@ -3,7 +3,6 @@ API used: POST /v1/payments/orders//authorize

/** @var \PayPal\Api\Payment $payment */ $payment = require __DIR__ . '/ExecutePayment.php'; -use PayPal\Api\Order; use PayPal\Api\Amount; use PayPal\Api\Authorization;

Approval Status

Determine if the user approved the payment or not

if (isset($_GET['success']) && $_GET['success'] == 'true') {

Retrieve the order

diff --git a/sample/doc/payments/OrderCapture.html b/sample/doc/payments/OrderCapture.html index ee92bd0..74e6fed 100644 --- a/sample/doc/payments/OrderCapture.html +++ b/sample/doc/payments/OrderCapture.html @@ -3,8 +3,8 @@ API used: POST /v1/payments/orders//authorize

/** @var \PayPal\Api\Payment $payment */ $payment = require __DIR__ . '/ExecutePayment.php'; -use PayPal\Api\Capture; -use PayPal\Api\Amount;

Approval Status

+use PayPal\Api\Amount; +use PayPal\Api\Capture;

Approval Status

Determine if the user approved the payment or not

if (isset($_GET['success']) && $_GET['success'] == 'true') {

Retrieve the order

OrderId could be retrieved by parsing the object inside related_resources.

$transactions = $payment->getTransactions(); $transaction = $transactions[0]; diff --git a/sample/doc/payments/OrderDoVoid.html b/sample/doc/payments/OrderDoVoid.html index 0f131db..bc4f7ec 100644 --- a/sample/doc/payments/OrderDoVoid.html +++ b/sample/doc/payments/OrderDoVoid.html @@ -2,10 +2,7 @@

Use this call to void an existing order. Note: An order cannot be voided if payment has already been partially or fully captured. API used: POST /v1/payments/orders//do-void

/** @var \PayPal\Api\Payment $payment */ -$payment = require __DIR__ . '/ExecutePayment.php'; - -use PayPal\Api\Capture; -use PayPal\Api\Amount;

Approval Status

+$payment = require __DIR__ . '/ExecutePayment.php';

Approval Status

Determine if the user approved the payment or not

if (isset($_GET['success']) && $_GET['success'] == 'true') {

Retrieve the order

OrderId could be retrieved by parsing the object inside related_resources.

$transactions = $payment->getTransactions(); $transaction = $transactions[0]; diff --git a/sample/doc/payments/Reauthorization.html b/sample/doc/payments/Reauthorization.html index d865fdc..fe5f347 100644 --- a/sample/doc/payments/Reauthorization.html +++ b/sample/doc/payments/Reauthorization.html @@ -3,8 +3,8 @@ account payment. API used: v1/payments/authorization/{authorization_id}/reauthorize

/** @var Authorization $authorization */ $authorization = require 'AuthorizePayment.php'; -use PayPal\Api\Authorization; -use PayPal\Api\Amount;

Reauthorization

+use PayPal\Api\Amount; +use PayPal\Api\Authorization;

Reauthorization

Reauthorization is available only for PayPal account payments and not for credit card payments.

You can reauthorize a payment only once 4 to 29 days after the 3-day honor period for the original authorization diff --git a/sample/doc/payments/RefundCapture.html b/sample/doc/payments/RefundCapture.html index 7f138fa..4d1a157 100644 --- a/sample/doc/payments/RefundCapture.html +++ b/sample/doc/payments/RefundCapture.html @@ -4,10 +4,8 @@ process a refund on a Captured transaction. API used: /v1/payments/capture/{}/refund

/** @var Capture $capture */ $capture = require 'AuthorizationCapture.php'; -use PayPal\Api\Authorization; use PayPal\Api\Capture; -use PayPal\Api\Refund; -use PayPal\Api\Amount;

Refund

+use PayPal\Api\Refund;

Refund

Create a refund object indicating refund amount and call the refund method

$refund = new Refund(); $refund->setAmount($amt); diff --git a/sample/doc/sale/GetSale.html b/sample/doc/sale/GetSale.html index 4b4616a..bc2a15f 100644 --- a/sample/doc/sale/GetSale.html +++ b/sample/doc/sale/GetSale.html @@ -4,8 +4,8 @@ This sample code demonstrates how you can retrieve details of completed Sale Transaction. API used: /v1/payments/sale/{sale-id}

/** @var Payment $payment */ $payment = require __DIR__ . '/../payments/CreatePayment.php'; -use PayPal\Api\Sale; -use PayPal\Api\Payment;

Get Sale From Created Payment

+use PayPal\Api\Payment; +use PayPal\Api\Sale;

Get Sale From Created Payment

You can retrieve the sale Id from Related Resources for each transactions.

$transactions = $payment->getTransactions(); $relatedResources = $transactions[0]->getRelatedResources(); $sale = $relatedResources[0]->getSale(); diff --git a/sample/index.php b/sample/index.php index 2fea260..d8cb5a7 100644 --- a/sample/index.php +++ b/sample/index.php @@ -426,16 +426,17 @@ if (PHP_SAPI == 'cli') { class="fa fa-file-code-o">
- -
  • -
    Authorize Payment Using PayPal
    +
    +
    Step II: Execute after Success + (required step after user approval)
    +