Retrieve Credits in SendGrid with PHP - php

I am attempting to build a sales platform with sendgrid integration, currently due to cost limitations I want to limit email transactions to sendgrid's free plan of 400 emails/day.
Is there a way I can retrieve the remaining email quota programmatically in PHP?
I have seen this question (link) but I am not familiar with ruby, i believe that this is a workaround.

You would need to set up the user as a subuser of the main account, and then use the Customer Subuser API to check/limit the credits. However, the Customer Subuser API is only available to customers on SendGrid's Silver plan and higher, so if you're on the free plan, you won't be able to do this.

There is not a way to retrieve the quota; it can be inferred by knowing how many you get a day (resets at 00:00 PT), and subtract what you've sent.

You can't retrieve the credit quota, but SendGrid will error out and the response will say that you've exceeded your credits.
Just keep sending and stop when it errors out.

Related

Reminder for WeChat Store Service Account user using push notification

We are preparing to create a eCommerce website that can be run from WeChat Store. Although there are enough information such as ICP, the developer account for the Tencent SDK, etc, but can't find information on auto-reminder-feature through WeChat app.
For example, my customer may have purchase some product from our new WeChat Store. Then, we want to sent a reminder after X days for them to refill it. Instead of spamming them through email, we were wondering whether we can utilize the push notification feature provided by WeChat Store.
Service account can sent up to 4 push messages per month, but, if we want to sent a custom message for different users, are we allow to do so?
Thanks!
yes, provided you have each customers open id

Prevent unauthroized calls to API

I am working on an API that can be used between my server and my iOS app. I have an SQL database that contains an Accounts table which includes a column called BALANCE.
People can make a real money deposit to my website through PayPal or I will be allowing them to send money orders. The problem is, when the PayPal SDK checks to make sure it was a legitimate deposit, then it credits that users account balance. When I receive the money order, I credit their balance via my website.
Each time the balance is credited, a call to my API happens. The thing is, I can do this over and over without actually getting PayPal deposits or money order deposits.
See, the users will transfer balances between each others accounts. So I don't need any help with making sure deposits were legit, I got that already. Right now a simple API call will transfer one balance amount over to another account without proof that the call was for a legitimate reason. I don't want to be able to have people somehow tap into the API and credit their own balance somehow. It needs to be where people can't just alter it.
So what can I put in place so that people cannot just tap into my API and credit their balance without actually sending money? Since this is real money, I am putting a lot of time into security.
You could authenticate with OAuth, which is what the majority of web service API's are using these days.
This tutorial may be of interest to you.

Recieve SMS+email+any other way notifications through button click on website made in php

I've recently made a food ecommerce based website in PHP. I've included online ordering and I'll be manually attending to orders instantly. So I need to receive a notification on one or more mobiles/emails/any other way so that one of us can instantly confirm and deliver the order. How should I go about it? What gateways are present for this kind of job? I'm willing to shell out a certain amount of money for such a service.
Thanks!!
You can use this service
http://html.mobily.ws/English/Solutions/Developers/PHPSMS.html
Example included.. It will cost you 15$ for 500 SMS.
Here are a few paid SMS APIs:
Nexmo
Twilio
Tropo
Pricing for all is from 1 cent to 2 cents per message. Nexmo (as far as I know), is the only SMS provider to publish quality of delivery rates, so you can see how well messages are delivered to the specific networks you'll be using (DLR rate is the important rate).
Here are a few paid email APIs:
SendGrid
Postmark
Mailgun
All three allow both sending and * receiving* email through the API (similar to how the above SMS APIs work), meaning you could easily support email and SMS side by side. Also, parsing incoming email is painful to do manually, so if you're considering allowing a reply to take some action on the order, that will make it easy.
Pricing for all varies, but it's pretty inexpensive across the board.
Disclaimer, I do developer evangelism part time at Nexmo.

Paypal API donations split to different business accounts

Hi is possible to split a paypal online donation to different paypal account letting user paying only 1 time?
i mean , user pays 30€ i would like to send 50% of them to 1 PP account and 50% to another PP account...
any idea guys? :)
You can use paypal's mass pay system after the payment has been made to the main account. You can get the data in and out using the API.
General overview docs:
https://merchant.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=merchant/mass_pay
API docs:
https://www.x.com/community/ppx/mass_pay
The trick in a system like this, is trying not to get soaked on fees, giving too much money to paypal. Mass pay has no fees for the receiver, and low fees for the sender. Its also easy to process programatically.
The other way to do it would obviously be to just use the API and code it up to do the split and send the $ to each party using standard 'send a payment' though the API. But you'll wind up giving a lot more money to paypal that way, mass pay is usually the better choice.

Instant UPS tracking Number

I have a client that has a shopping cart. She wants to implement a module that allows the end user to receive a tracking number immediately after purchase.
I am not too sure if this is possible. My concept is that after the store owner ships the purchase, that's when the store owner receives a tracking number that he/she can give to the purchaser. And the purchaser then can start tracking their package.
I guess my question is... "Is it possible to generate a tracking number to give to the purchaser before the store owner even bothers to wrap up the order and send it out.This is so the purchaser can automatically start tracking their purchase and the store owner doesn't have to manually give them a tracking number." ?
I know this would have to require the api. I just need to know if this is possible before I start investing alot of time in trying to build it.
She is using Magento for her shopping cart service.
You can use what's called a tracking reference.
From UPS:
When you create a shipment, you can
assign a shipment reference that helps
you track quickly and with ease. This
reference can contain up to 35
characters in any combination of
letters and numbers
http://www.ups.com/content/us/en/resources/track/check/#Track+by+Reference
UPS will store this reference number in its system so that you can have customers track with that instead. They will need to click Track By Reference in the Track Packages & Freight tab.
It's "possible" in that way that everything in software is possible. There's nothing built-in or third party that I know of that would build this functionality into a system though. My experience with the UPS shipping API says that even if you created a UPS shipment at the time of ordering, there's a non-deterministic delay before the actual shipping code is created. See mention of tracking reference in this thread.
If you want to move forward with this, it means creating your own tracking system. Immediately after generating an order you also generate a unique tracking number, and a tracking URL. This URL points at your system, and returns a page that lists ou;t any UPS, FedEX, etc tracking numbers that are in the system for that order. If the order hasn't received its number yet, you list a message like "at source warehouse" instead.
Good luck, ERP and fulfillment integration is always a bear.
As far as i think Magento has built-in support for such tracking services.
Dont remember if it supports UPS but i guess it does.
Otherwise use the UPS Developer API and play around with their web services.
And for the advance tracking number as you require that feature is also implemented in Magento for shipping packages as well as order tracking etc...
PS: I observed these in Magento 1.4+
You can get bundles of shipping forms with fields such as your business name, address, account etc that are prefilled. These bundles also have sequenced tracking numbers.
You would have to get these bundles and upon receiving them enter the starting number and ending number of the stack into a database. From there the person packing the order must be careful to use the correct form with the order.
If you interface with ShipWorks and set it up with your UPS account, it both creates your UPS shipping label, gets the shipping charge and posts the UPS tracking number back to Magento. Very smooth integration.

Categories