> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transaction.finalizePayPalAuth

The `finalizePayPalAuth` method completes the authorization of a PayPal payment method validation transaction. Use this method only when working with a `Transaction` that is paid for with a PayPal-based payment method. The `authCapture()` call made to conduct a one-time transaction returns a PayPal site URL. Ask your customer to visit that URL so that they may complete the authorization process necessary to validate the payment method at PayPal’s site.

After the customer finishes the authorization sequence at the PayPal website, and is redirected to your site by PayPal, call the `finalizePayPalAuth` method from either the success page (`returnUrl` specified in the PayPal payment method) or the failure page (`cancelUrl` specified in the payment method) to which the customer was redirected. This method enables you to tell Subscribe the status of the `Transaction`, so that Subscribe can move it out of its `AuthorizationPending` status. If authorized, Subscribe sets the status of the transaction to `Authorized`, and then schedules it for capture.

For more information on applying tax to PayPal transactions, please see [Transaction.addressAndSalesTaxFromPayPalOrder](Transaction_addressAndSa).

**Note:** Billing Success emails will not be issued for the Transaction until this call is made.

## Input

*srd*: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a `method` call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the *srd*. A null *srd* returns the complete response.

*payPalTransactionId*: Vindicia’s ID for the PayPal payment method validation `Transaction`, generated when you called `Transaction`. Retrieve this ID from the value associated with the name: `vindicia_vid` in the name–value pairs attached to the redirect URL.

*success*: set to `true` if the customer successfully authorized the validation transaction at PayPal’s site and was redirected to the success page (`returnUrl`) hosted by you. If the customer was redirected to the failure page (`cancelUrl`), set this to `false`.

## Output

*return*: an object of type `Return` that indicates the success or failure of the call.

*transaction*: the resultant `Transaction` object after finalization. It contains the updated `status` of the transaction.

## Returns

This method returns the codes listed in [The Return Object](The_Return_Object).

## Example

```

$soap_caller = new Transaction();
  
 // obtain the id of the PayPal transaction from the redirect URL. 
 // It is the value associated with name 'vindicia_vid'
  
 $payPalTxId = … ;
  
 // if calling from return URL which is reached when the PayPal
 // transaction is successfully authorized, set the
 // success input parameter to true, from the cancelUrl,
 // set it to false. Let's assume success here:
  
 $success = true;
 $response = 
    $soap_caller->finalizePayPalAuth($payPalTxId, $success);
  
 if($response['returnCode'] == 200) {
 $txId = $response['transaction']->getMerchantTransactionId();
 printLog "Transaction authorized: " . $txId;
 }
```

**Parent topic:**[Transaction Methods](../topics/Transaction_Methods)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.