I have created an application in which there is in-app purchases which has monthly auto renewal.. on first time successful payment i have called a web-service in which i have made the user to premium class.
Now if the user has cancelled the payment manually from the google server, how could i know that user has cancelled his/her subscription.
Is there is some PHP code query or from android i have to called something in background to check the status??
Thank you in advace
I haven't tested this, but could you use the autoRenewing field in INAPP_PURCHASE_DATA?
If true, the subscription is active, and will automatically renew on the next billing date. If false, indicates that the user has canceled the subscription.
http://developer.android.com/google/play/billing/billing_reference.html#getBuyIntent
Apparently, the autoRenewing field was added or at least documented in the beginning of 2015.
You can check the purchased subscriptions inside the app via
Edit: For subscriptions use "subs", for inapp-purchases use "inapp" e.g.:
Inapp-Purchases: mService.getPurchases(3, getPackageName(), "inapp", null);
Subscriptions: mService.getPurchases(3, getPackageName(), "subs", null);
See also Querying for Purchased Items at http://developer.android.com/google/play/billing/billing_integrate.html
So you can implement a task in your app where you check if the user still has a subscription. If not, you can remove the premium status. Moreover this information could be useful for you:
When the user cancels a subscription, Google Play does not offer a refund for the current billing cycle. Instead, it allows the user to have access to the canceled subscription until the end of the current billing cycle, at which time it terminates the subscription. For example, if a user purchases a monthly subscription and cancels it on the 15th day of the cycle, Google Play will consider the subscription valid until the end of the 30th day (or other day, depending on the month).
source: http://developer.android.com/google/play/billing/billing_subscriptions.html under subscription cancelled
Hope this could help you
Edit2: Because the AIDL library which is mentioned in my answer is deprecated and deactivated in the future, it is recommended to switch to the new Google Play Billing Library.
Check the getPurchases() method here. Or if you use Android Studio and have the source code downloaded just press Ctrl + Q on IInAppBillingService.getPurchases method
Related
I am working on integrating Google Billing Library into my application for making purchases from my app. I have created a 1-month test subscription from the application. Every time a subscription is auto-renewed, a subscription resource is returned then i am using the value of "IsAutorenewing" for processing of the purchase in my app
After few renewals of the existing subscription, i have cancelled the subscription and tried to query the purchases using querypurchasesasync but this time the subscription resource is not returned after the subscription is cancelled to check the value of IsAutoRenewing
Can you please suggest why cancelled purchase is not returned & what needs to be done in order to get the cancelled purchase also?
I am using checkout-one-time-payments for stripe for subscription and one time payments.This is the demo link from stripe https://70p1h.sse.codesandbox.io/.
I am able to successfully collect payments for one time and subscription products . What I want to do now is to show a page that shows all the saved cards for the particular user if user has already made payment from stripe and then if user selects the pre saved card ,I want to move the customer direct to payment confirmation or failure. Dont want the user to re enter the card details and other info
I am using following code in backend for java
SessionCreateParams.Builder builder = new SessionCreateParams.Builder()
.setSuccessUrl(createcheckoutSessionRequest.getSuccessUrl() + "?session_id={CHECKOUT_SESSION_ID}").setCancelUrl(createcheckoutSessionRequest.getFailureUrl())
.addPaymentMethodType(PaymentMethodType.CARD)
.setMode(product.getIsSubscriptionProduct() ? SessionCreateParams.Mode.SUBSCRIPTION
: SessionCreateParams.Mode.PAYMENT)
I am quite confused with all these docs ,I am not able to find the actual scenario in docs ,any help will be really appreciated. Thanks
Using a customer's saved cards is not something that is currently supported by Checkout.
If you want to build this functionality yourself you'd have to do the following:
Retrieve all of a Customer's Payment Methods using the Stripe API (https://stripe.com/docs/api/payment_methods/list).
Once a Payment Method has been selected, use it along with the Customer ID to create a Payment Intent (https://stripe.com/docs/payments/save-during-payment#web-create-payment-intent-off-session) or a Subscription (https://stripe.com/docs/api/subscriptions/create).
Depending on the status of payment, redirect to your own success or failure page.
Stripe now supports using a customer's saved cards in Checkout.
This feature is automatically enabled in Checkout unless the 'Link with Stripe' feature is disabled in Stripe Settings. You may find more information about this in the docs.
Is there any way to pass the saved payment method directly to session object?
Yes. Pass a Customer object with an attached card payment method to a Checkout Session, and Checkout will prefill that customer’s previously saved card details so they can complete the payment with a 1-click checkout experience. You can read more about this in the docs.
Source: Stripe support
to integrate PayPal payment into Java web application ,i use this link Text,
but when i verify the paypal sandbox account for both buyer and seller i found the transaction will be added but it has a "pending" status and the money is not changing,so i want to complete the transaction to transfer money from buyer to seller and paypal inform me whether the transaction is successful or not.
I found the transaction will be added but it has a "pending" status
There are a few possible reasons for this, one is simply the expected behavior of requestPayment.setIntent("authorize");. You may simply want to change that to "sale" if it's not being captured automatically by the guide you were following.
Another possible reason is the currency if it is new to that sandbox receiver account. Log into the receiver account via https://www.sandbox.paypal.com , and see if you can accept one of the payments in the new currency, which will open a currency balance. Future payments won't be pending.
Also ensure the sandbox Business account receiving the payment has a confirmed email in the sandbox environment...
Log into it at https://www.sandbox.paypal.com/businessprofile/settings/email
Send the confirmation from there, if necessary
Read and proceed with the confirmation, via https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fnotifications%2F
I'm integrating paypal express checkout on one website and I'm using PaypalFunctions.java that I've download in the customized example.
I've successfull called, in development environment, the ppf.callMarkExpressCheckout
and after login on Paypal page I've correctly reached my confirmation page where i catch the payerId from the request.
I can't understand if the process is complete or I need to make a further step to get money and end the process.
I have this doubt because the process and the methods name is quite different than the one described in https://developer.paypal.com/docs/classic/express-checkout/gs_expresscheckout/ and I don't receive any mail from paypal dev environment
Kind regards
In express checkout , once the buyer comes to your return url after confirming the Payments from their account you need to call the "DoExpressCheckout" API using the token and the payer id you received on your return url . Until this step completes , No payment will be recorded and hence no emails will be sent out . You can check the documentation for "DoExpressCheckout " API here :
https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_NVP/
https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/
If I got you right, you don't know how pay pal gets back to you. Look for 'returnUrl' (and 'cancelUrl') in https://developer.paypal.com/docs/classic/express-checkout/gs_expresscheckout/ . That's URL pay pal calls on your application once the user authorized the payment on the pay pal site.
I am using the (Java) Rest API to perform payments directly from credit cards in the sandbox. The payments all receive "pending" status, which according to the docs (https://developer.paypal.com/webapps/developer/docs/api/#create-a-payment) is not even a valid state to be returned by the payment create call. Payment review is disabled.
I would like to see the process through and complete the transaction. How do I do that in the sandbox? Or should I receive a different state right away?
Under http://developer.paypal.com, Application tab, find out the email associated to the REST app.
Now click on "Sandbox accounts", Click on the REST app email, click on "Profile" link.
Select "Setting" tab, and turn off "Payment review". You shall get "Approved" payment and "Completed" Sale json object.
this is the same issue with paypal status is pending so answer should be the same, just check the seller's selling preferences on the sandbox account like Max-P said, this is just different currency and config issue on paypal