when i am getting the api payload,
when i am trying to access wocommerce api, i am getting all the orders details under product_meta node.
https://example.com/wc-api/v3/orders/?fields=order_meta,product_meta&filter[meta]=true&consumer_secret=xxx&consumer_key=xxx
i got this results
see the output here in postman
But i want this all details comes under order_meta node like this:
"
order_meta":{
"card_message":"Happy Birthday Lina!!! Love Dave and Louis x",
"delivery_date":"01\/09\/2023",
"order_notes":"Deliver to front desk"
}
},
please help me out.
Related
I am trying to fetch order status in real time in php but not able to find proper way or documentation so I can go ahead.
In sales api I am getting details of sold subscription, but I want payment pending and cancelled orders too.
In Documentation I got below link
https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.subscriptions/list
Gets below output when I run it in Try this method
{
"error": {
"code": 403,
"message": "The project ID used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
"status": "PERMISSION_DENIED"
}
}
But i am not able to implement it in PHP.
I had the same question so I raised a ticket and got reply that google play does not provide any API for order status, its available for kotlin and java only,
I have integrated a smart button checkout functionality in a marketplace where anybody can sell/buy items from anybody.
I also have successfully installed a webhook listener that gets notified if a refund of payment has been issued.
But in the body of the refund event received, I am failing to find information WHICH payment/transaction has been refunded.
By reading the event with
file_get_contents('php://input');
I will get the JSON encoded event details like this:
{
"id":"WH-3WS24689NP236083V-89P84301TC0576916",
"event_version":"1.0",
"create_time":"2020-07-10T15:36:33.720Z",
"resource_type":"refund",
"resource_version":"2.0",
"event_type":"PAYMENT.CAPTURE.REFUNDED",
"summary":"A EUR 7.89 EUR capture payment was refunded",
"resource":{
"seller_payable_breakdown":{
"total_refunded_amount":{
"value":"7.89",
"currency_code":"EUR"},
"paypal_fee":{
"value":"0.15",
"currency_code":"EUR"
},
"gross_amount":{
"value":"7.89",
"currency_code":"EUR"},
"net_amount": {
"value":"7.74",
"currency_code":"EUR"
}
},
"amount":{
"value":"7.89",
"currency_code":"EUR"
},
"update_time":"2020-07-10T08:36:00-07:00",
"create_time":"2020-07-10T08:36:00-07:00",
"links":[
{"method":"GET","rel":"self","href":"https://api.sandbox.paypal.com/v2/payments/refunds/3TF6899507696873K"},
{"method":"GET","rel":"up","href":"https://api.sandbox.paypal.com/v2/payments/captures/5U107751JJ334642K"}
],
"id":"3TF6899507696873K",
"status":"COMPLETED"
},
"links":[{
"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-3WS24689NP236083V-89P84301TC0576916",
"rel":"self",
"method":"GET"},{
"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-3WS24689NP236083V-89P84301TC0576916/resend",
"rel":"resend",
"method":"POST"}
]
}
So I get the data. But within the data I can not find any information like a "transaction id", "order id" or similar which I could use to look up in the DB if it matches the capture id (from capture order) of a previous order.
What do I need to do to get the information I need? Or am I looking in the wrong place/for the wrong field?
In case I need to auth the request first and make another request to get more data, I would be very grateful for a FULL example (or link to an example) in PHP as I can not make sense of the Paypal documentation on webhooks.
EDIT: It seems that in one of the links (in the event above), the capture ID (which is the same as the transaction id txn) of the original payment is "hidden" in one of the links providing endpoints. In this case: 5U107751JJ334642K
I can only shake my head at Paypal's way of making things incredible difficult to achieve. How can you NOT have a dedicated field with the id of the original transaction in a refund message?
Welcome to the wonderful world of Hypermedia as the Engine of Application State (HATEOAS [emphasis added…])!
The purpose of which is to give your application the information needed to discover and navigate to / execute related resources / actions dynamically. To that end, each API response or webhook payload contains a list of links.
As you have already discovered, in the present case, those link back to the parent resource, i.e. the refunded capture, via the up relationship.
While it may be tempting to extract the capture ID straight from the href, it might be safer to actually follow that link. You will receive the original capture response from which you can either grab the capture id or continue following the up link to get to the authorization.
You can find a little more information on PayPal's HATEOAS implementation on https://developer.paypal.com/docs/api/reference/api-responses/#hateoas-links. Those rel types that are standardized are documented on https://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1. For example, the description of rel="up" is "refers to a parent document in a hierarchy of documents".
I need to use PHP to count the number of active subscriptions in my PayPal account (people subscribed to my service, not the counts of services I'm subscribed to).
Does anyone know how to do this or can point me in the right direction?
I can't find any documentation that allows you to see a list of your active subscriptions via the API, but I'm assuming that PayPal has this option and I'm just missing it...
This option cannot be found because it's apparently not available:
https://github.com/paypal/PayPal-REST-API-issues/issues/5
Apparently you cannot get a list of subscriptions regardless the status for the time being, as you can see here https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions there is no such feature available so let's hope Paypal adds it in the future.
However if you are storing the subscription ids in a database then you can loop them and foreach subscription id you can get the details of the subscription https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_get and check its status and finally display only the ones with an active status.
https://www.paypal.com/billing/api/orchestrator/subscriptions?data=%7B%22total_required%22%3Atrue%2C%22sort_order%22%3A%22desc%22%2C%22page_size%22%3A%2220%22%2C%22page%22%3A%221%22%2C%22plan_ids%22%3A%22P-123456789ABCDE%22%2C%22statuses%22%3A%22ACTIVE%22%2C%22tab%22%3A%22all%22%7D
Just pass a query string like:
{"plan_ids":"P-123456789ABCDE","statuses":"ACTIVE"}
You can GET this, and specify a page size. It seems the max is 20, but you can change the page number too.
Change the plan_ids parameter that I have as "P-123456789ABCDE" to your plan ID and you'll get a JSON response. I'm sure this isn't advertised, but I found it digging through the PayPal site.
There doesn't appear to be a direct way to list all of your subscriptions, but you can use the Transaction Search API to retrieve a list of your transactions (one month at a time, max 500 results per page) and grab the paypal_reference_id of each transaction object, which will be a valid subscription ID if the paypal_reference_id_type is "SUB".
Here's an example of the GET URL, which requires an Oauth token:
https://api-m.sandbox.paypal.com/v1/reporting/transactions?start_date=2022-07-01T00:00:00-0700&end_date=2022-07-31T23:59:59-0700&fields=all&page_size=500&page=1
Here's a simplified example of the response data:
{
"transaction_details":
[
"transaction_info":
{
"paypal_reference_id": "I-ABCDEFGHIJKL",
"paypal_reference_id_type": "SUB",
}
]
}
Once you've retrieved all of your subscription IDs, you can use the Subscriptions API to retrieve their details (such as its status) via an authenticated GET request:
https://api-m.sandbox.paypal.com/v1/billing/subscriptions/I-ABCDEFGHIJKL
Here's a simplified example of the response data:
{
"status": "ACTIVE",
}
anyone can help on facebook insights? I'm trying to get the Total Reach using facebook graph API.
Here's my example:
http://www.screencast.com/t/1deguhkEuMb
I've been trying these following metrics:
/page_impressions_frequency_distribution
/page_impressions_viral_frequency_distribution
But I still can't get the right value for the Total Reach.
Anybody can help me?
Thanks in advance.
Try using the metric /post_impressions_unique
This will return the number of people who saw your Page post
Just tested it and the response object contains:
"title": "Lifetime Post Total Reach",
"description": "Lifetime: The total number of people your Page post was served to. (Unique Users)"
https://developers.facebook.com/docs/graph-api/reference/v2.3/insights
I'm currently trying to use the steam web api to get the tags items in a player's steam inventory.
An example of what I'm looking for is shown below:
I'm been looking at the steam web api, but I haven't found any methods that return the tags on a steam inventory item.
Does anyone know how to grab this? Is it possible?
Any help would be appreciated.
If you want specifically these tags: check your console while you switching games inventories. There will be ajax request link.
For example for TF2: http://steamcommunity.com/profiles/YOUR_STEAM_ID/inventory/json/440/2/
Replace "YOUR_STEAM_ID" with some user steamid64.
If you want other game inventory: change "440" with(570 - dota2, 620 - portal2, 730 - csgo, 753 - steam inventory).
Also with steam inventory you have to change following to it number(1 - gifts, 6 - cards, there also 3 and 7 numbers for other items)
Request that link like other api methods. It will return json, that you have to decode/parse.
Then watch "rgDescriptions" array. There will be your tags.