Google-checkout notification callbacks - google-checkout

I have problem with Notification API callbacks. I've implemented callbacks in Sandbox account without problems, but when I switched into production no notification arrived and Integration console is empty. I set up SSL url...
Thanks for help.
Tomas

When "switching" to production, did you:
check if you are using your production merchant id and key?
check if you have adjusted the urls where you POST data to (urls are also different for sandbox and production)?

Related

Play & App Store Webhooks / Server Side Code on subscription start and cancel

I need to add server side logic when a user buys and cancels a subscription. To me this seems like a basic feature that many apps probably use. However as it turns out it's not that simple to setup up the need webhooks.
My App will be available on android and iOS, so I will need to configure both, which is why I thought about using RevenueCat. But it turns out, this is a paid feature for $110/month, which is way too much for a/my new app. This is probably the biggest time saver for RevenueCat compared to using the official InApp Purchases packages, so I don't see why they would make it a paid feature.
Anyways what the best way to handle webhooks with the Play Store and the App Store? Any Guides and Tipps would be very helpful!
Apple and Google both offer server-to-server notifications that will notify you when a subscriber cancels.
Apple guide: Enabling Server-to-Server Notifications
Google guide: Real-time developer notifications
If you have your own user Ids, they won't be present in these server notifications so on your server you can save the user Id along with the transaction identifier of their original purchase. That way when a notification comes in you can look up the user from the transaction identifier and flag them as cancelled.
Alternatively, the RevenueCat API is included on their free plan so you can periodically poll their GET /subscribers endpoint to get the latest subscription status for a user. This obviously won't be real-time, but may be enough for your use-case.
Update: I decided to solve this issue similar as #enc_life suggested with the RevenueCat API. For validation the purchase, I send a request to my server, that checks with if the user actually bought the subscription. For canceling the subscription, I execute a function everyday on my server, that checks for all subscribers if the subscription is still valid.

Sending web push notifications from Laravel

I have a website running Laravel in the back-end, where users can create reports for other users.
When the report is created I would like to send a push notification to recipient user's desktop.
Do I need to use services like Pusher, OneSignal?
Any useful site with examples would be appreciated.
Your question
You could use Pusher, Redis/Socket.io, Pubnub, etc. Which one to use? well, this is more an opinion-based question.
These services broadcast events, then in your client apps (like your web front-end) you configure the client-side libraries of the service you choose to subscribe (to channels) and listen to those events. The documentation explains it better.
Examples/tutorials
Pusher
This is a tutorial published by the Pusher team.
Redis/Socket.io
This one
is a Laracasts series about this.
Just google.
Update
There is a Laravel-specific alternative, a package created exclusively for Laravel:
Laravel WebSockets
This is the post talking about the package and its inner working.
This is the repo.
Here you have the documentation.
If you like to show Native Desktop notification then i would suggest Web Push notification. In this way once user subscribed to push notification ,they will get real time notification and does not need to be on your website.
https://github.com/laravel-notification-channels/webpush

Slack API re-activate user after deactivating by users.admin.setInactive

When a user was deactivated (after using undocumented API method users.admin.setInactive), is there any possibilities to re-activate him using slackAPI? Unfortunatelly i didn't find any method for this...
The only way I've found is by using Slack SIM API. See PATCH /Users/{id} on:
https://api.slack.com/scim
Worth mentioning this is only available to Slack workspaces on the Plus plan and Slack Enterprise Grid.
Hope that helps!
After long searching it is possible to get users reactivated with the free api. You can not do it with a legacy key and api key. But you can with an session api key
see https://github.com/SvenHamers/slack-sessiontoken for an example how to automate it (Golang)
Api: users.admin.setRegular

Setting Parse Cloud Code Function as a Destination URL [duplicate]

Firstly I see there are several Parse / Stripe questions on here however none are of any help to me.
I have a mobile application that has both free and paid features. A variable is stored on the User class in Parse.com and it is checked for permissions when running a function. I would like to setup an account portal (separate to my app) so when users wish to signup they are sent to their browser and can signup to a plan over SSL etc etc.
For the account portal i'm having a Wordpress site with a Stripe plugin that will do my accounting, invoicing and form creation work for me.
Following signup on the Wordpress site I would like to receive the webhook on Parse.com and run a function to update User class. Ideally this will be a catch all function that will change the user to a number of states depending on their account status (i.e they stop paying and the plan will be on hold).
My question is two fold:
What details (URL etc) do I need to place in my Stripe webhook settings to send all events to my Parse.com cloud code?
How do I receive / run my function on the Cloud code upon receipt of a webhook from Parse.com?
I am open to criticism and remain flexible in my implementation if you have suggestions on how my app should work.
Many thanks in advance.
Ok after some experimenting:
create a webhook on in the Stripe Accounts area using the URL:
https://**APPLICATION_ID**:javascript-key=**JAVASCRIPT_KEY**#api.parse.com/1/functions/update_user
In your cloud code use the same function name as the final part of your URL. in my case update_user.
Create a test version of the webhook and place this in your cloud code for testing :
Parse.Cloud.define("update_user", function(request, response) {
response.success('** WEBHOOK WORKING **' + request);
});
When running the test in the stripe dashboard you should see:
Hope that this helps someone - Would be grateful of any input anyone has as to my implementation or a slick function to run on my User class update.
Mostly I think your solution will work.
I think using the javascript key could pose a security risk if you are not validating events that come from stripe.
Your javascript keys will be present in your web site. Someone could get it and call your cloud code function. I'd use the master key so you know its only from sources you trust. They might be able change important billing information.
In your cloud function definition you can check if the master key was used.
Parse.Cloud.define('stripeEvents', function (request, response) {
if (request.master){
return response.success('stripeEvents - master');
}
response.error('stripeEvents - must use master key');});

Improving WebMail performance MVC3

I'm using the MVC helper WebMail to send emails. However the speed of it seems to be of concern. Especially when I have to send more than 1 email at the same time. I tried using a thread, but that didn't work since the Webmail object was null. How do I speed this up? Any ideas appreciated.
Forgot to mention, this is during testing and I'm using localhost and gmail! Not sure if that is causing the issue.
Thank you
If you want performance, don't use the WebMail helper. Use the classes in the System.Net namespace.
This allows you to open a new thread and send the email out-of-band from the web request.
We use Google Apps mail (gmail) in the cloud, opening a new thread, and sending the email from there, using the System.Net types (not WebMail). It works pretty well, as we can respond to the user without having to wait for the email to be sent.
Be careful about using Google Apps / gmail though, especially in development. We had one of our accounts disabled by google because of this. During development, you should use your local ISP, or better yet, use SpecifiedPickupDirectory, as it works better when unit testing email receipt.

Resources