forked from LiveCarta/PayPal-PHP-SDK
Remove credit card samples (#896)
* removed credit card payment samples * update docs to reflect sample changes * update readme to recommend braintree for direct card payments
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
// process a refund on a Captured transaction.
|
||||
// API used: /v1/payments/capture/{<captureID>}/refund
|
||||
/** @var Capture $capture */
|
||||
$capture = require 'AuthorizationCapture.php';
|
||||
|
||||
|
||||
use PayPal\Api\Capture;
|
||||
use PayPal\Api\Refund;
|
||||
@@ -14,15 +14,22 @@ use PayPal\Api\RefundRequest;
|
||||
// Create a refund object indicating
|
||||
// refund amount and call the refund method
|
||||
|
||||
$refundRequest = new RefundRequest();
|
||||
$refundRequest->setAmount($amt);
|
||||
// Replace $captureId with any static Id you might already have.
|
||||
$captureId = "<your authorization id here>";
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// Create a new apiContext object so we send a new
|
||||
// PayPal-Request-Id (idempotency) header for this resource
|
||||
$apiContext = getApiContext($clientId, $clientSecret);
|
||||
|
||||
// ### Retrieve Capture details
|
||||
$capture = Capture::get($captureId, $apiContext);
|
||||
|
||||
// ### Refund the Capture
|
||||
$captureRefund = $capture->refundCapturedPayment($refundRequest, $apiContext);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Refund Capture", "Capture", null, $refundRequest, $ex);
|
||||
|
||||
Reference in New Issue
Block a user