问题
I have a wallet integrated Web product using the subscriptions API, as described here in the documentation. Have simulated an initial payment and a cancelation, and all works well.
Does the Google Wallet server call the server (obviously the client might not be online at the time) back on each recurring renewal?
回答1:
Recurring payments happen automatically with no callback to the merchant server.
The customer will receive an email confirmation when the recurring payment has been processed.
回答2:
So you will get a postback only twice: when you subscribe and when you cancel. This sounds good but it is more complex than this. Here are two examples:
- User Cancelation
Let's say that the customer decided to cancel mid-trial period. You will receive the notification callback instantly even before the trial is over. This means that on your end you will have to figure out what to do. In theory, you should match the order id with the data you have recorded for the subscription and give the remaining time back to the user, i.e. not disable their account immediately.
The situation is very similar when a paying customer decides to cancel. If they cancel in the middle of their billing period, you will have to look back when the period started, and round their to the nearest billing cycle and allow them to use your service until then. This can create a few problems because the method will likely differentiate from what Google is doing on their side.
- Failed Payment
This is where we get into problems. Google will automatically cancel the subscription if the payment has failed but that will occur perhaps a few days into the new billing cycle. When you receive the notification callback there is no way of knowing the reason for the cancelation so typically you don't know what to do. If you cancel the order immediately and the notification was for a paying customer trying to cancel the order so that they don't hit the next billing date then you will have to give their remaining days for which day already payed. But because there is no way of differentiating the cancelations you cannot tell if this is due to an invalid credit card in which case you should cancel immediately.
The only solution to this problem is to manually investigate your orders. And this is what sucks about Google Wallet although it is a pretty cool service.
来源:https://stackoverflow.com/questions/15592992/does-google-wallet-server-calls-back-on-every-renewal-of-a-subscription