Open Monograph Press
3.3.0
|
Additional Inherited Members | |
![]() | |
const | API_VERSION = 'v1' |
![]() | |
createResponse ($data, $statusCode) | |
createResponse ($data, $statusCode) | |
getHttpMethod () | |
getHttpMethod () | |
![]() | |
getCurrencies () | |
getParameter ($key) | |
setParameter ($key, $value) | |
setParameter ($key, $value) | |
![]() | |
$liveEndpoint = 'https://api.paypal.com' | |
$payerId = null | |
$testEndpoint = 'https://api.sandbox.paypal.com' | |
![]() | |
$currencies | |
$httpClient | |
$httpRequest | |
$negativeAmountAllowed = false | |
$parameters | |
$response | |
$zeroAmountAllowed = true | |
PayPal REST Complete Purchase Request
Use this message to execute (complete) a PayPal payment that has been approved by the payer. You can optionally update transaction information when executing the payment by passing in one or more transactions.
This call only works after a buyer has approved the payment using the provided PayPal approval URL.
The payer ID and the payment ID returned from the callback after the purchase will be passed to the return URL as GET parameters payerId and paymentId respectively.
See RestPurchaseRequest for the first part of this example transaction:
$paymentId = $_GET['paymentId']; $payerId = $_GET['payerId'];
// Once the transaction has been approved, we need to complete it. $transaction = $gateway->completePurchase(array( 'payer_id' => $payer_id, 'transactionReference' => $sale_id, )); $response = $transaction->send(); if ($response->isSuccessful()) { // The customer has successfully paid. } else { // There was an error returned by completePurchase(). You should // check the error code and message from PayPal, which may be something // like "card declined", etc. }
$paymentId = $_GET['paymentId']; $payerId = $_GET['payerId']; // Once the transaction has been approved, we need to complete it. $transaction = $gateway->completePurchase(array( 'payer_id' => $payerId, 'transactionReference' => $paymentId, )); $response = $transaction->send(); if ($response->isSuccessful()) { // The customer has successfully paid. } else { // There was an error returned by completePurchase(). You should // check the error code and message from PayPal, which may be something // like "card declined", etc. }
RestPurchaseRequest https://developer.paypal.com/docs/api/#execute-an-approved-paypal-payment Definition at line 48 of file lib/vendor/omnipay/paypal/src/Message/RestCompletePurchaseRequest.php.
Omnipay\PayPal\Message\RestCompletePurchaseRequest::getData | ( | ) |
Get the raw data array for this message. The format of this varies from gateway to gateway, but will usually be either an associative array, or a SimpleXMLElement.
Implements Omnipay\Common\Message\MessageInterface.
Definition at line 56 of file lib/vendor/omnipay/paypal/src/Message/RestCompletePurchaseRequest.php.
References Omnipay\PayPal\Message\AbstractRestRequest\getPayerId(), and Omnipay\Common\Message\AbstractRequest\validate().
Omnipay\PayPal\Message\RestCompletePurchaseRequest::getData | ( | ) |
Get the raw data array for this message. The format of this varies from gateway to gateway, but will usually be either an associative array, or a SimpleXMLElement.
Implements Omnipay\Common\Message\MessageInterface.
Definition at line 56 of file vendor/omnipay/paypal/src/Message/RestCompletePurchaseRequest.php.
References Omnipay\PayPal\Message\AbstractRestRequest\getPayerId(), and Omnipay\Common\Message\AbstractRequest\validate().
Omnipay\PayPal\Message\RestCompletePurchaseRequest::getEndpoint | ( | ) |
Reimplemented from Omnipay\PayPal\Message\AbstractRestRequest.
Definition at line 67 of file vendor/omnipay/paypal/src/Message/RestCompletePurchaseRequest.php.
References Omnipay\Common\Message\AbstractRequest\getTransactionReference().
Omnipay\PayPal\Message\RestCompletePurchaseRequest::getEndpoint | ( | ) |
Reimplemented from Omnipay\PayPal\Message\AbstractRestRequest.
Definition at line 67 of file lib/vendor/omnipay/paypal/src/Message/RestCompletePurchaseRequest.php.
References Omnipay\Common\Message\AbstractRequest\getTransactionReference().