Google places autocomplete widget using the Basic SKU but still getting charged - google-places-api

I'm using the Google places autocomplete widget and since Google applied the billing changes the widget is becoming very costly to maintain. I have added the basic parameters which are supposed to be free but when I view the billing I'm still getting charged for the SKU: Autocomplete without Places Details – Per Session. This is the code I'm using:
var searchBox = new google.maps.places.Autocomplete(input);
searchBox.setFields(['place_id', 'name', 'types']);
So my question is, is there a way to get the autocomplete dropdown without getting charged with the new google places API?

Please note that the setFields() method is only applicable when a user selects a place from the autocomplete suggestions. When a place is selected, a Places Details request is made which is the one that generates Data SKUs (Basic, Contact, and/or Atmosphere), depending on the fields that are specified in the request. If you specify Basic Data in your Places Details request, you will be billed for the Places Details request and not for any additional Data SKUs (like Atmosphere and Contact Data) when a user selects a place.
In your case you are only charged for all autocomplete requests and not with any Data SKU. To explain the charge that you got for SKU: Autocomplete without Places Details – Per Session, you are charged for this for the times when a user has not selected any place from the autocomplete suggestions within a few minutes of the beginning of the session. This happens when a user only types characters in the autocomplete input box but is not selecting any place from the search results.
If you have setup your billing account, you will be entitled to the recurring $200 monthly free credits.
Currently, since API requests are charged as per the pricing, if you want to stay in the free tier usage, you can cap your API usage by setting a daily limit to them. This is to avoid unexpected charges by limiting the number of API calls you can make per day.
Hope this clarifies it.

The pricing for implementing the autocomplete SearchBox is different than using the autocomplete widget. The searchbox uses the places text search functionality, which automatically bills for all three places data categories. The widget, however, allows you to mask data fields and automatically creates a session that begins when the user starts typing and ends when a selection is made. With the searchbox, you are getting billed per end user keystroke, which will rack up your charges incredibly fast. I highly recommend implementing the widget over the searchbox.

Related

Where can I find sold item notes in the Square API?

I'm trying to create a report to pull my Square POS transaction data into Excel through Power Query. Basically, I want the information available in the standard "Items Detail CSV" report found in the Square Dashboard, but connected to Excel so I can build custom reporting and update it any time with a refresh.
I can connect to the Square data in Excel no problem. What I'm having trouble with is finding the right data, specifically the notes the merchant can enter in during the time of sale about the item. We have several items that will come up as "Custom Amount" where we enter additional notes about the item, and I can't find the notes field through the API.
After looking through the documentation, I've tried two main queries:
The Transactions List from v2:
https://connect.squareup.com/v2/locations/{location_id}/transactions
The Payments List from v1:
https://connect.squareup.com/v1/{location_id}/payments
The Payments List includes the v1PaymentItemization data type, which should include the notes field defined as "Notes entered by the merchant about the item at the time of payment, if any." I assume that's what I'm looking for.
(Link to documentation: https://docs.connect.squareup.com/api/connect/v1#type-v1paymentitemization)
However, I cannot find the notes field anywhere in my pulled results. There are no error messages, and I see every data field listed in the v1PaymentItemization documentation except "notes" in my query results.
Edit: The notes we're using are on individual items, not the payment as a whole. This fits the description of V1 List Payments -> PaymentItemization -> notes. I did check the tender notes as mentioned in the comments, but this was not what I'm looking for. Until now, I wasn't aware we could make a comment on the transaction as a whole, as opposed to individual items. The individual items notes would be more helpful anyway.
Either way, I didn't find the tender notes in the pulled data either. Most of the fields are there in the data pull, but not notes, v1TenderEntryMethod, and a couple of others. There's actually more data available in the standard dashboard reports than is actually pulling from the API.
I do realize a workaround is to export the Item Detail CSV report from the Square Dashboard, and then manipulate the data in Excel from there. I could even have a connection to the folder or file where I save my exports. It's just not as smooth as the desired result of opening Excel, setting my parameters there, and clicking refresh to get the data and formatted report all in one place.
Thanks
Second Edit: In the POS, I'm entering an amount which shows up as Custom Amount in the itemized list for the sale. I then click on the Custom Amount to add a note to it and specify what the item is (e.g., "Lamp"). That note is applied to a single item, and there may be several items per transaction that have these notes added to them which would otherwise only show as "Custom Amount" on a report or receipt. We do this because we sell several items that are not standard inventory items, but we do want to keep track of what we've sold.
I can see these notes for each item in the standard reporting, so I know the data is entered and saved correctly. However, I can't find the note field when I pull from the API. I see all of the other itemization fields (i.e., name, quantity, item_detail, itemization_type, etc.), but not the note field.
I'm getting these results with a simple /v1/payments pull with no parameters or filters.

Laravel payment multi subscriptions

I am working on a SAAS project where users can create various projects. With each project, they can choose from 5 different plans. Each plan has its own costs per month. Hotjar is a kind of equal concept.
Now I want to arrange the subscription with Stripe. The problem with that was that a user can have a maximum x subscription, which of course was a shame. Then I decided to take 1 subscription that has several plans. But now I have a dilemma, to update the subscription you have to change the number via SubscriptionItem. Then you have to save yourself which plan has which SubscriptionItem_id for which user. That is quite a detour and can cause many problems.
Someone is a better way with Stripe or another payment software.
You don't necessarily need to store the subscritpion_item IDs, you can look it up via the subscription_item list API. All you need to do is store the subscription_id for your customers, and based on that ID you can retrieve the list of subscription_items:
\Stripe\Stripe::setApiKey("sk_test_9GavlLpfiKewqeCBXvRvmVgd");
\Stripe\SubscriptionItem::all(["subscription" => "sub_EQlPGjVj4o5luH"]);
Then you can handle the data part of the returned JSON object and update / delete / etc these subscription items.
If you only have the customer_id handy, then you can use the subscription list API (with status as well on the GET params) to retrieve the list of active subscriptions.

Retrieving Card details from Square Customer

I'm trying to create a recurring payment on Square, ala Stripe subscriptions. However, I am having trouble retrieving a customer's card information (specifically customer_card_id) to pass into Charge.
Our flow is such:
A customer visits to our store and subscribes to a membership, which we process via the point of sale app.
We continuously poll Square to retrieve payment information, and create membership records appropriately.
When the user's membership period expires, charge them for the next month's membership.
When researching RetrieveCustomer, I find that there is a cards property under Customer, but iterating through all the Customers under our account, they all have cards = None despite us having taken card payments via the point of sale app.
Also, looking at ListTransactions, there doesn't seem to be anything that might be customer_card_id. The IDs I see there are tender ID, location ID, and transaction ID. The card_fingerprint also looks promising but that doesn't seem right either, since a card can have both an ID and a fingerprint.
Am I missing something? Where might I find customer_card_id?
EDIT
Looks like I was dumb and my local instance of our application was just out of date with transactions from Square. After updating my data with customers we've processed since the last time I updated, customers with a non-None card property now show up. tristansokol's answer below is still valid however.
How do you process the first charge? You need to explicitly add the card on file, it won't be added by default from processing a transaction from a customer. See: https://squareup.com/help/us/en/article/5770-use-card-on-file-with-the-square-point-of-sale-app

Credit usage when Google Places API does not return Place ID

I'm looking to store Google Place ID for several different places (millions of records). I have purchased a premium plan usage.
Will Google deduct my credits for those records which don't have a Place ID (or Place ID is not returned) ?
Maps API Credits are deducted based on the number of requests made to the Places API, not the values or fields like Place ID, returned within those requests. Credits will be consumed anytime the request doesn't return an error so if you're getting some results (or ZERO_RESULTS), credits are being consumed.
As a Google Maps API Premium Plan customer, feel free to contact the support team for these sort of questions.

How to show only permitted user_type fields on frontend

How would one go about creating a function/plugin for the following?
I have two user_types, FREE and PAID.
Both users have certain fields they can fill in. The PAID user has more fields they can fill in.
If a PAID user reverts back to a FREE user, how can only the FREE fields show on the frontend without showing the already PAID fields?
There must be a way to filter the fields per user_type? I'm very much a noob at writing code.
If anyone could explain and guide me, that would be great.
Cheers,
I have done something like this some time ago for something different. It was about showing content only to users with a specific user level.
You could register new user roles and check whether the current user (of the site, probably logged in) has the appropiate user role to view specific content.
I used is_user_in_role on the frontend and that works fine for me.
Concerning the PAID fields: Let the users fill them with content but add a notice like "Pay to show these fields publicly" on the frontend when he visits his own profile (or whatever you are building). This sometimes works very well for getting more paid users (make sure, you really have a benefit from those fields).

Resources