I am very new in square payment.
I get response below. Now I need transaction ID from this response.
What's the best way to get it from this response?
---->Array
(
[*errors] =>
[*transaction] => SquareConnect\Model\Transaction Object
(
[id:protected] => 14bad261-60a6-56d7-6422-3ec8b7cdd10e
[location_id:protected] => CBASEGb8XMvdzZkrjf0H3PiMRi8gAQ
[created_at:protected] => 2018-03-12T10:23:33Z
[tenders:protected] => Array
(
[0] => SquareConnect\Model\Tender Object
(
[id:protected] => 7924ab32-9544-5139-673e-8ff5d0767858
[location_id:protected] => CBASEGb8XMvdzZkrjf0H3PiMRi8gAQ
[transaction_id:protected] => 14bad261-60a6-56d7-6422-3ec8b7cdd10e
[created_at:protected] => 2018-03-12T10:23:33Z
[note:protected] => Online Transaction
[amount_money:protected] => SquareConnect\Model\Money Object
(
[amount:protected] => 100
[currency:protected] => USD
)
[tip_money:protected] =>
[processing_fee_money:protected] =>
[customer_id:protected] =>
[type:protected] => CARD
[card_details:protected] => SquareConnect\Model\TenderCardDetails Object
(
[status:protected] => CAPTURED
[card:protected] => SquareConnect\Model\Card Object
(
[id:protected] =>
[card_brand:protected] => VISA
[last_4:protected] => 1111
[exp_month:protected] =>
[exp_year:protected] =>
[cardholder_name:protected] =>
[billing_address:protected] =>
[fingerprint:protected] => 9334946c94d2a20de8b1e267cc221a23298daed43b44621b4f44a0d032f0fc88
)
[entry_method:protected] => KEYED
)
[cash_details:protected] =>
[additional_recipients:protected] =>
)
)
$result->getTransaction()->getId();
Related
i have this array:
Array
(
[0] => stdClass Object
(
[MarketCurrency] => LTC
[BaseCurrency] => BTC
[MarketCurrencyLong] => Litecoin
[BaseCurrencyLong] => Bitcoin
[MinTradeSize] => 0.03039514
[MarketName] => BTC-LTC
[IsActive] => 1
[IsRestricted] =>
[Created] => 2014-02-13T00:00:00
[Notice] =>
[IsSponsored] =>
[LogoUrl] => https://bittrexblobstorage.blob.core.windows.net/public/6defbc41-582d-47a6-bb2e-d0fa88663524.png
)
[1] => stdClass Object
(
[MarketCurrency] => DOGE
[BaseCurrency] => BTC
[MarketCurrencyLong] => Dogecoin
[BaseCurrencyLong] => Bitcoin
[MinTradeSize] => 462.96296296
[MarketName] => BTC-DOGE
[IsActive] => 1
[IsRestricted] =>
[Created] => 2014-02-13T00:00:00
[Notice] =>
[IsSponsored] =>
[LogoUrl] => https://bittrexblobstorage.blob.core.windows.net/public/a2b8eaee-2905-4478-a7a0-246f212c64c6.png
)
}
I would get the "MarketCurrency" data and "BaseCurrency" data. But I don't know how to do.
How can I do this?
I need your help.
You can do it with simple foreach() to grab the objects.
foreach($data as $obj){
echo "MarketCurrency = $obj->MarketCurrency and BaseCurrency = $obj->BaseCurrency".PHP_EOL;
}
I'am tryng to get the value that an adress sent me on my adress, I have already setted up the webhook, but i can't understand a thing...
I have this array->
Array
(
[network] => tBTC
[event_type] => address-transactions
[addresses] => Array
(
[2MyXzRYSzrExLitY6FumGC3QgzCeqVoeQC1] => -49320
)
[data] => Array
(
[raw] =>
[hash] =>
[first_seen_at] => 2017-10-13T17:19:35+0000
[last_seen_at] => 2017-10-13T17:19:35+0000
[block_height] => 1210150
[block_time] => 2017-10-13T17:20:18+0000
[block_hash] =>
[confirmations] => 2
[is_coinbase] =>
[estimated_value] => 30000
[total_input_value] => 49320
[total_output_value] => 45510
[total_fee] => 3810
[estimated_change] => 15510
[estimated_change_address] => 2N7iSxafSoio4RE8wrd6outJNmbMkyP9QuL
[high_priority] =>
[enough_fee] =>
[contains_dust] =>
[inputs] => Array
(
[0] => Array
(
[index] => 0
[output_hash] =>
[output_index] => 0
[output_confirmed] => 1
[value] => 49320
[sequence] => 4294967295
[address] => 2MyXzRYSzrExLitY6FumGC3QgzCeqVoeQC1
[type] => scripthash
[multisig] =>
[multisig_addresses] =>
[script_signature] =>
)
)
[outputs] => Array
(
[0] => Array
(
[index] => 0
[value] => 30000
[address] => 2NBkQ8aTq8yeXdMWtxXNuxNgEHYnrzvcpV2
[type] => scripthash
[multisig] =>
[multisig_addresses] =>
[script] => OP_HASH160 OP_EQUAL
[script_hex] =>
[spent_hash] =>
[spent_index] => 0
)
[1] => Array
(
[index] => 1
[value] => 15510
[address] => 2N7iSxafSoio4RE8wrd6outJNmbMkyP9QuL
[type] => scripthash
[multisig] =>
[multisig_addresses] =>
[script] => OP_HASH160 OP_EQUAL
[script_hex] =>
[spent_hash] =>
[spent_index] => 0
)
)
[opt_in_rbf] =>
[unconfirmed_inputs] =>
[lock_time_timestamp] =>
[lock_time_block_height] =>
[size] => 367
)
[retry_count] => 0
And I'am tryng to get ONLY THE VALUE OF BTC (SATOSHI) THAT COME ON MY ADRESS, SO WITH THE SUBSTRACTION OF THE FEES, i thought that for get this values I had to get the
$Data=BlocktrailSDK::getWebhookPayload();
$Data['data']['estimated_value'];
Is this correct way to get at the 1000000% THE VALUE OF BTC (SATOSHI) THAT COME ON MY ADRESS, SO WITH THE SUBSTRACTION OF THE FEES, if is not what is the correct way??Anyway thanks for ready, hope that you all had a good day, and thanks for your time :)
P.S Note that on this transaction i sent 30000 satoshi+fees!
Cleeng_Entity_Collection Object
(
[entityType:protected] => Cleeng_Entity_SubscriptionOffer
[items:protected] => Array
(
[0] => Cleeng_Entity_SubscriptionOffer Object
(
[id:protected] => S955494970_US
[publisherEmail:protected] => vidya+mtc#ooyala.com
[url:protected] =>
[title:protected] => Annual subscription
[description:protected] =>
[period:protected] => year
[price:protected] => 49.99
[applicableTaxRate:protected] => 0
[currency:protected] => USD
[accessToTags:protected] => Array
(
[0] => d962607d3d4c4e3c98a343c7bcb64027
)
[active:protected] => 1
[createdAt:protected] => 1473681112
[updatedAt:protected] => 1473858745
[geoRestrictionEnabled:protected] =>
[geoRestrictionType:protected] =>
[geoRestrictionCountries:protected] => Array
(
)
[pending:protected] =>
[country] => US
[socialCommissionRate] => 0
[averageRating] => 4
[contentType] =>
[freePeriods] => 0
[freeDays] => 0
[expiresAt] =>
)
)
[totalItemCount:protected] => 5
[pending:protected] =>
)
All you need to do is just convert the Collection to a Regular Array and then json_encode() the Result like so:
<?php
$entityCollection = "???"; // THIS IS THE DATA FROM Cleeng_Entity_Collection Object
$entityArray = $entityCollection->toArray();
$entityJSON = json_encode($entityArray);
I have an Array which i got after converting from an XML, This XML is coming from amazon seller account. It has got all the orders which are available in my seller account.
Im using Yii 2.0 php framework, Im passing this array to view after converting from XML to array in controller. This is my array..
Array
(
[ListOrdersResult] => Array
(
[CreatedBefore] => 2016-07-11T05:59:05Z
[Orders] => Array
(
[Order] => Array
(
[0] => Array
(
[AmazonOrderId] => 171-4557760-7388350
[PurchaseDate] => 2016-06-01T13:07:46Z
[LastUpdateDate] => 2016-06-03T12:43:26Z
[OrderStatus] => Canceled
[FulfillmentChannel] => MFN
[SalesChannel] => Amazon.in
[ShipServiceLevel] => IN Exp Dom 2
[OrderTotal] => Array
(
[CurrencyCode] => INR
[Amount] => 40.00
)
[NumberOfItemsShipped] => 0
[NumberOfItemsUnshipped] => 0
[PaymentExecutionDetail] => Array
(
)
[MarketplaceId] => A21TJRUUN4KGV
[ShipmentServiceLevelCategory] => Expedited
[ShippedByAmazonTFM] => false
[OrderType] => StandardOrder
[EarliestShipDate] => 2016-06-01T18:30:00Z
[LatestShipDate] => 2016-06-03T18:29:59Z
[IsPrime] => false
[IsPremiumOrder] => false
)
[1] => Array
(
[AmazonOrderId] => 403-4718683-0373128
[PurchaseDate] => 2016-06-03T12:30:20Z
[LastUpdateDate] => 2016-06-03T14:02:13Z
[OrderStatus] => Canceled
[FulfillmentChannel] => MFN
[SalesChannel] => Amazon.in
[ShipServiceLevel] => IN Exp Dom 2
[OrderTotal] => Array
(
[CurrencyCode] => INR
[Amount] => 40.00
)
[NumberOfItemsShipped] => 0
[NumberOfItemsUnshipped] => 0
[PaymentExecutionDetail] => Array
(
)
[MarketplaceId] => A21TJRUUN4KGV
[ShipmentServiceLevelCategory] => Expedited
[ShippedByAmazonTFM] => false
[OrderType] => StandardOrder
[EarliestShipDate] => 2016-06-03T18:30:00Z
[LatestShipDate] => 2016-06-06T18:29:59Z
[IsPrime] => false
[IsPremiumOrder] => false
)
)
)
)
[ResponseMetadata] => Array
(
[RequestId] => 42c3353b-d6af-459f-9421-5e8b7efb8ea8
)
)
Here each array is am order, Now i want to display one by one.. can anyone kindly help me how to i display.. Im using Yii2 Php framework for this project... Thank you..
It should be something like this:
$myArray['ListOrdersResult']['Orders']['Order'][0]['AmazonOrderId'] = '171-4557760-7388350';
function print_order($order) {
foreach ($order as $key1=>$val) {
if (is_array($val))
print_order($val);
else
print "$key1 = $val<br/>\r\n";
}
}
print_order($myArray['ListOrdersResult']['Orders']['Order']);
I am trying to get the recurrence of an event with the Google Calendar API in PHP, and it doesn't show me the recurrence.
The following code is the code I'm using:
$params = array(
'orderBy' => 'startTime',
'singleEvents' => true,
'timeMin' => date('c'),
);
$listarEventos = $service->events->listEvents($calendar_id, $params);
foreach ($listarEventos->getItems() as $i){
echo "<pre>";
echo $i->recurrence;
print_r($i);
echo "</pre>";
echo "<br>";
}
And I am obtaining this type of objects:
Google_Service_Calendar_Event Object
(
[collection_key:protected] => recurrence
[internal_gapi_mappings:protected] => Array
(
)
[anyoneCanAddSelf] =>
[attendeesType:protected] => Google_Service_Calendar_EventAttendee
[attendeesDataType:protected] => array
[attendeesOmitted] =>
[colorId] =>
[created] => 2015-06-01T07:34:46.000Z
[creatorType:protected] => Google_Service_Calendar_EventCreator
[creatorDataType:protected] =>
[description] =>
[endType:protected] => Google_Service_Calendar_EventDateTime
[endDataType:protected] =>
[endTimeUnspecified] =>
[etag] => "286628817348xxxx"
[extendedPropertiesType:protected] => Google_Service_Calendar_EventExtendedProperties
[extendedPropertiesDataType:protected] =>
[gadgetType:protected] => Google_Service_Calendar_EventGadget
[gadgetDataType:protected] =>
[guestsCanInviteOthers] =>
[guestsCanModify] =>
[guestsCanSeeOtherGuests] =>
[hangoutLink] =>
[htmlLink] => https://www.google.com/calendar/event?eid=czlqcW9uNmg1aGV0cTBwYXRrcnIxc2dqc3MgcHJ1ZWJhY2FsZW5kYXJpbxxxxxt
[iCalUID] => s9jqon6h5hetq0patkrr1sgjss#google.com
[id] => s9jqon6h5hetq0patkrr1sxxxxx
[kind] => calendar#event
[location] => Gra
[locked] =>
[organizerType:protected] => Google_Service_Calendar_EventOrganizer
[organizerDataType:protected] =>
[originalStartTimeType:protected] => Google_Service_Calendar_EventDateTime
[originalStartTimeDataType:protected] =>
[privateCopy] =>
[recurrence] =>
[recurringEventId] =>
[remindersType:protected] => Google_Service_Calendar_EventReminders
[remindersDataType:protected] =>
[sequence] => 0
[sourceType:protected] => Google_Service_Calendar_EventSource
[sourceDataType:protected] =>
[startType:protected] => Google_Service_Calendar_EventDateTime
[startDataType:protected] =>
[status] => confirmed
[summary] => Prueba recurrencia
[transparency] =>
[updated] => 2015-06-01T07:34:46.742Z
[visibility] =>
[modelData:protected] => Array
(
[creator] => Array
(
[email] => xxxx#gmail.com
[displayName] => Prueba Calendario
[self] => 1
)
[organizer] => Array
(
[email] => xxxxx#gmail.com
[displayName] => Prueba Calendario
[self] => 1
)
[start] => Array
(
[dateTime] => 2015-06-19T03:01:00+02:00
[timeZone] => Europe/Madrid
)
[end] => Array
(
[dateTime] => 2015-06-19T09:03:00+02:00
[timeZone] => Europe/Madrid
)
[reminders] => Array
(
[useDefault] => 1
)
)
[processed:protected] => Array
(
)
)
I have to say that I store the recurrence with the following code:
$event->setRecurrence(array('RRULE:FREQ='.$FREQ.';INTERVAL='.$INTERVAL));
And I have proved that the event is recurrent, so I donĀ“t know why I can't get the recurrence.
Thanks a lot!
You won't get recurrence if you're using 'singleEvents' => true.
Documentation (https://developers.google.com/google-apps/calendar/v3/reference/events/list) says:
singleEvents boolean Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False.
I have solved the question. You won't get the recurrence if you doesn't get the event with something like this:
$event = $service->events->get('primary', "recurringEventId");
Once you have $event, you can use:
$preevent->recurrence[0]
Thanks to Xeron for the answer.