php - How to call GetExpressCheckoutDetails from Omnipay/PayPal? -
i need accept paypal express payments laravel-4 app, trying decide if omnipay best solution. sticking point doesn't seem implement getexpresscheckoutdetails, purchaser's contact details not accessible. i've seen these discussions problem:
omnipay paypal express not returning address
receive more response data in ci-merchant library codeigniter
however, neither give definitive solution. if use omnipay, have install paypal's classic api (in case, why bother omnipay), or can implement getexpresscheckoutdetails in omnipay, , if so, how?
thanks in advance on this.
omnipay\paypal\progateway.php
add new function
public function fetchexpresscheckoutdetail(array $parameters = array()) { return $this->createrequest('\omnipay\paypal\message\fetchexpresscheckoutrequest', $parameters); }
omnipay\paypal\src\message
add new file fetchexpresscheckoutrequest.php
namespace omnipay\paypal\message; class fetchexpresscheckoutrequest extends abstractrequest { public function getdata() { $data = $this->getbasedata('getexpresscheckoutdetails'); $this->validate('transactionreference'); $data['token'] = $this->gettransactionreference(); $url = $this->getendpoint()."?user={$data['user']}&pwd={$data['pwd']}&signature={$data['signature']}&method=getexpresscheckoutdetails&version={$data['version']}&token={$data['token']}"; parse_str (file_get_contents( $url ),$output); $data = array_merge($data,$output); return $data; } }
usage:
$response = $gateway->completepurchase($params)->send(); $data = $response->getdata(); $gateway->fetchexpresscheckoutdetail(array('transactionreference'=>$data['token']))->getdata();
it not best. works. :)
Comments
Post a Comment