forked from LiveCarta/PayPal-PHP-SDK
Add getToken() to Payment class to get the EC token from the Approval URL
This commit is contained in:
@@ -546,6 +546,18 @@ class Payment extends PayPalResourceModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get token from Approval Link
|
||||||
|
*
|
||||||
|
* @return null|string
|
||||||
|
*/
|
||||||
|
public function getToken()
|
||||||
|
{
|
||||||
|
$parameter_name = "token";
|
||||||
|
parse_str(parse_url($this->getApprovalLink())['query'], $query);
|
||||||
|
return (!isset($query[$parameter_name]) || is_null($query[$parameter_name])) ? null : $query[$parameter_name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Creates and processes a payment. In the JSON request body, include a `payment` object with the intent, payer, and transactions. For PayPal payments, include redirect URLs in the `payment` object.
|
* Creates and processes a payment. In the JSON request body, include a `payment` object with the intent, payer, and transactions. For PayPal payments, include redirect URLs in the `payment` object.
|
||||||
*
|
*
|
||||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||||
|
|||||||
Reference in New Issue
Block a user