how to get googleplay realtime purchases list using developer api like https://play.google.com/console/u/0/developers/XXX/orders page? - google-play-developer-api

I hope to show realtime billings of my products in my own manage panel. Can I get realtime status of all my order billings those days( unpaied, pending, canceled, not consumed, finished etc) by google developer api without pay token?(since if user not paid, there is no token for some orders)

Related

Fetching Facebook Ad spends grouped by campaign names

I wanted to fetch the daily ad spends in Facebook based on campaigns separately, ie, for each campaign with its spend.
I have tried with API call, but that gives state wise classification. How do I group based on campaign names?
"https://graph.facebook.com/v14.0/act_xxxxxx/insights?" + encodeURI("level=ad&fields=spend&access_token=FB_ACCESS_TOKEN&breakdowns=region,country&time_range={'since':'2022-08-09','until':'2022-08-09'}&filtering=[{\"field\":\"country\",\"operator\":\"CONTAIN\",\"value\":\"US\"}]&limit=100")
Campaigns and adsets has an insights field where you can read performance and spending metrics.
Get insights from campaigns endpoint
https://graph.facebook.com/v14.0/act_xxx/campaigns?fields=name,insights{spend}
you can use date filters with you calls to get lifetime spending.
you can also get spending from campaign adset insights field.
Check the official documentation
https://developers.facebook.com/docs/marketing-api/reference/ad-campaign/insights

Facebook marketing ads api not returning spend for paused campaigns

I am trying to fetch all my campaigns in specific ad account and i want to return the spend for each campaign but the api only returns the running campaign spending however the paused campaign only the name. here is the api i am using
act_ad_account_id/campaigns?fields=name,insights{spend},effective_status{vec},spend_cap&date_preset=last_year
As the doc state, under the voice spend:
The estimated total amount of money you've spent on your campaign, ad
set or ad during its schedule. This metric is estimated.
That means that the value is returned when the campaign/adset/ads is actually scheduled, so that the api does not return any value when the campaign is set on PAUSED because the spend is actually null (or zero).

Bulk Transaction Processing - Auto Pay Scenario

We are using Authorize.net for our payment (credit card & ach) processing and implementing an auto-pay feature for our billing system.
Is there a way to process cards (payment profiles stored by authorize.net) in bulk and get a callback with the results instead of calling the api for every profile that needs to be charged?
Authorize.Net does not offer a bulk payment API. They do offer a bulk payment upload but it does not offer support for payment profiles.

Stripe Webhooks: Invoice.paid vs Checkout.Session.Completed

I use Stripes' webhooks and want to get notified, if the customer successfully "paid the bill". I came across two webhooks, which in my opinion both could do the job:
Webhook "invoice.paid" - According to Stripe doc: Occurs whenever an invoice payment attempt succeeds or an invoice is marked as paid out-of-band.
Webhook "checkout.session.completed" - According to Stripe doc: Occurs when a Checkout Session has been successfully completed.
My questions are:
I don't understand the second part of the "invoice.paid" webhook: "invoice is marked as paid out-of-band" -> What does "out-of-band" mean? Is this to be considered a successful payment?
Regarding "checkout.session.complete" -> This can also occur, if payment fails - correct?
Which webhooks shall I consider (or are there other webhooks) to see the status "customer paid the bill successfully"?
What is more, I don't really know if disputes should be considered as successful payments or not: On one hand, I get a invoice.paid webhook, on the other hand, I get a charge.dispute.created webhook. geeezus...
I appreciate your help! Thanks.
I don't understand the second part of the "invoice.paid" webhook: "invoice is marked as paid out-of-band" -> What does "out-of-band" mean? Is this to be considered a successful payment?
This is specifically referring to marking an invoice paid out of band (ie, the customer paid you outside of Stripe and you want to mark the Stripe invoice paid without collecting a payment). This will not involve an actual payment, but does transition the invoice to status=paid so this event fires.
Regarding "checkout.session.complete" -> This can also occur, if payment fails - correct?
This event signals only that the Checkout session is complete. Depending on the mode use for Checkout, this may or may not involve a payment. If an immediate payment is expected, the session will only complete if that payment is successful. For example mode=setup or mode=subscription with a free trial will not involve an immediate payment. A subscription with trial, though, will create a $0 invoice and fire invoice.paid.
Which webhooks shall I consider (or are there other webhooks) to see
the status "customer paid the bill successfully"?
This depends on what you mean by "paid" and "bill". If you mean specifically for invoices (whether related to subscriptions or not), then invoice.paid is a good choice. You can then filter for amounts greater than $0 etc to further constrain was "paid" means.
What is more, I don't really know if disputes should be considered as
successful payments or not: On one hand, I get a invoice.paid webhook,
on the other hand, I get a charge.dispute.created webhook.
Disputes are not payments, and should be an entirely separate discussion. You can only have a dispute after a payment. Suggest starting by reading the docs on disputes.
To summarize: What are you really trying to do? These events are related and sometimes overlap, but not always. It highly depends on what you're doing.
What's going on?
When you create a checkout session it will have an id, which you'll store in your database next to the user who started the checkout session.
When you receive an invoice.paid webhook event, it does not have any link back to the checkout session! (so you'll know someone paid, but you won't know who paid!)
checkout.session.completed solves this because it contains the id of the checkout session and the stripe customer id, which allows you to link the two, so you basically have a mapping from your customer ids to stripe's customer ids.
So simply grab the customer id from the checkout.session.completed event and store it in your database next to the relevant user, that way you'll be able to tell which one of your users is paying you when you receive an invoice.paid event!
How can this be implemented?
When a checkout session is started, store the checkout session id next to the user who started the session so you can look it up later
When you see checkout.session.completed, look at the accompanying JSON and take the stripe customer number and store it in your database (e.g. a column like stripe_id in users table). To figure out which of your users it's for, use the checkout session id to look it up in your database (i.e. the data you stored in step 1)
Now that you have the stripe customer id stored in your users table, whenever you see invoice.paid, look at the accompanying JSON, take the stripe customer number, look it up in your users table to find who paid, and update the expiry date of their subscription to 1 month into the future.
That's it!
Also good to know
Both checkout.session.completed and invoice.paid events are triggered when someone new subscribes, and only invoice.paid is triggered each month thereafter (presuming the user had enough funds and didn't cancel)
You can get to the stripe customer number in both webhook events like so (this is ruby, but should be similar with js or python):
payload = request.body.read
data = JSON.parse(payload, symbolize_names: true)
data.object.customer
=> "cus_Lvyv721cJGpYB1"

How to get user count by status of facebook events (attending, Invited, etc..)

Is there any way to get the user count by status of facebook events? Facebook does this on the event page (the left columng with each status has a count next to it), but could not find any documentation on how to do the same. It needs to work for small or large events. For small events, I can easily get the list of users and do a quick count. But for events with over 1000 users, the previous method is too slow and not acceptable.
I don't think there's a better way than count every list of users as explained below.
You can which users are 'attending' an event by issuing an HTTP GET to /EVENT_ID/attending
You can which users have replied 'maybe' to an event by issuing an HTTP GET to /EVENT_ID/maybe
You can which users are declined an event (i.e. responded 'no') by issuing an HTTP GET to /EVENT_ID/declined
You can which users have not replied to an event by issuing an HTTP GET to /EVENT_ID/noreply
Taken from https://developers.facebook.com/docs/reference/api/event/
UPDATE 28-Jun:
As of today, Facebook added new fields to the Event FQL table that allows you to do exactly what you want.
From the developers blog:
We've added the following fields to the event FQL table to make it
easier to get the counts of users RSVP-ed to an event:
all_members_count
attending_count
unsure_count
declined_count
not_replied_count
They're pretty much self-explanatory.