forked from br-paypaldev/code-sample-pagamentos-recorrentes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getExpressCheckoutDetails.php
31 lines (23 loc) · 820 Bytes
/
getExpressCheckoutDetails.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp');
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query(array(
'USER' => 'usuario_da_api',
'PWD' => '1412312312',
'SIGNATURE' => 'assinatura.da.api',
'METHOD' => 'GetExpressCheckoutDetails',
'VERSION' => '108',
'TOKEN' => 'EC-0A9774676H705661Y'
)));
$response = curl_exec($curl);
curl_close($curl);
$nvp = array();
if (preg_match_all('/(?<name>[^\=]+)\=(?<value>[^&]+)&?/', $response, $matches)) {
foreach ($matches['name'] as $offset => $name) {
$nvp[$name] = urldecode($matches['value'][$offset]);
}
}
print_r($nvp);