I'm using the Paypal PHP SDK.
I can get this value:
$mail = $payment->payer->payer_info->email;
$name = $payment->payer->payer_info->first_name;
$lname = $payment->payer->payer_info->last_name;
$contry = $payment->payer->payer_info->shipping_address->country_code;
But, I wasn't able to get SKU. I tried these options:
// Option #1
$sku = $payment->transactions->item_list->items->sku;
// Option #2
$sku = $payment->transactions->item_list->items->0->sku;
But get nothing, and an error for the second option.
some part of output:
....
"payer": {
"payment_method": "paypal",
"status": "VERIFIED",
"payer_info": {
"email": "mymail@gmail.com",
"first_name": "name",
"last_name": "mylastname",
"payer_id": "00000000",
"shipping_address": {
.....
},
"country_code": "nnnnn",
"business_name": "nnnnn"
}
},
"transactions": [
{
"amount": {
"total": "0.01",
"currency": "USD",
"details": {}
},
"payee": {
"merchant_id": "00000000000",
"email": "mymail@gmail.com"
},
"description": "Payment description",
"invoice_number": "000000000",
"item_list": {
"items": [
{
"name": "nnnnnn",
"sku": "1562",
"price": "0.01",
"currency": "USD",
"quantity": 1
}
],
....
How can I get the value of SKU (1562)?