Я хочу внедрить serveride-sdk из Paypal на мой сайт.Пока все отлично работает.
После того, как намерение оплаты отправлено в Paypal, я получаю массив с информацией об оплате от Paypal.
Если я print_r
возвратил объект, он выглядит так в моем браузере:
PayPal\Api\Payment Object (
[_propMap:PayPal\Common\PayPalModel:private] => Array ( [intent] => sale [payer] => PayPal\Api\Payer Object (
[_propMap:PayPal\Common\PayPalModel:private] => Array ( [payment_method] => paypal ) ) [transactions] => Array ( [0] => PayPal\Api\Transaction Object (
[_propMap:PayPal\Common\PayPalModel:private] => Array ( [amount] => PayPal\Api\Amount Object (
[_propMap:PayPal\Common\PayPalModel:private] => Array ( [total] => 0.50 [currency] => EUR ) ) [related_resources] => Array ( ) ) ) ) [redirect_urls] => PayPal\Api\RedirectUrls Object ( [_propMap:PayPal\Common\PayPalModel:private] => Array ( [return_url] => https://www.fabiansquinobal.com/addjob_submitted.php [cancel_url] => https://example.com/your_cancel_url.html ) ) [id] => PAYID-LSSMWWI9WR61061C3673442W [state] => created [create_time] => 2019-04-03T15:03:52Z [links] => Array ( [0] => PayPal\Api\Links Object (
[_propMap:PayPal\Common\PayPalModel:private] => Array ( [href] => https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LSSMWWI9WR61061C3673442W [rel] => self [method] => GET ) ) [1] => PayPal\Api\Links Object (
[_propMap:PayPal\Common\PayPalModel:private] => Array ( [href] => https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-0RG36824VV460380F [rel] => approval_url [method] => REDIRECT ) ) [2] => PayPal\Api\Links Object (
[_propMap:PayPal\Common\PayPalModel:private] => Array ( [href] => https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LSSMWWI9WR61061C3673442W/execute [rel] => execute [method] => POST ) ) ) )
)
Я полностью поражен этим.Мне нужно знать, как мне добраться до "[id] => PAYID-LSSMWWI9WR61061C3673442W" или вообще извлечь информацию из этой "вещи".
С уважением
РЕДАКТИРОВАТЬ:
var_export
массива выглядит следующим образом:
PayPal\Api\Payment::__set_state(
array( '_propMap' => array ( 'intent' => 'sale', 'payer' => PayPal\Api\Payer::__set_state(
array( '_propMap' => array ( 'payment_method' => 'paypal', ), )), 'transactions' => array ( 0 => PayPal\Api\Transaction::__set_state(
array( '_propMap' => array ( 'amount' => PayPal\Api\Amount::__set_state(
array( '_propMap' => array ( 'total' => '15.00', 'currency' => 'EUR', ), )), 'related_resources' => array ( ), ), )), ), 'redirect_urls' => PayPal\Api\RedirectUrls::__set_state(array( '_propMap' => array ( 'return_url' => 'https://www.fabiansquinobal.com/addjob_submitted.php', 'cancel_url' => 'https://example.com/your_cancel_url.html', ), )), 'id' => 'PAYID-LSSNC7I1CX40811F59322531', 'state' => 'created', 'create_time' => '2019-04-03T15:30:05Z', 'links' => array ( 0 => PayPal\Api\Links::__set_state(
array( '_propMap' => array ( 'href' => 'https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LSSNC7I1CX40811F59322531', 'rel' => 'self', 'method' => 'GET', ), )), 1 => PayPal\Api\Links::__set_state(
array( '_propMap' => array ( 'href' => 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-98A35361RF153213R', 'rel' => 'approval_url', 'method' => 'REDIRECT', ), )), 2 => PayPal\Api\Links::__set_state(
array( '_propMap' => array ( 'href' => 'https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LSSNC7I1CX40811F59322531/execute', 'rel' => 'execute', 'method' => 'POST', ), )), ), ), )
)
An echo
объекта выглядит так:
{ "intent": "sale",
"payer": { "payment_method": "paypal" },
"transactions": [ { "amount": { "total": "0.50", "currency": "EUR" },
"related_resources": [] } ],
"redirect_urls": { "return_url": "https://www.fabiansquinobal.com/addjob_submitted.php", "cancel_url": "https://example.com/your_cancel_url.html" },
"id": "PAYID-LSSNFSY6AJ60558N2288040L",
"state": "created", "create_time": "2019-04-03T15:35:38Z",
"links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LSSNFSY6AJ60558N2288040L",
"rel": "self", "method": "GET" },
{ "href": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-5KK55362XB209301D",
"rel": "approval_url", "method": "REDIRECT" },
{ "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LSSNFSY6AJ60558N2288040L/execute",
"rel": "execute", "method": "POST" } ]
}