I am using paypal subscription button. if there is any method so that if user want to update his/her subscription amount after some time how could this achieve.
And how user can cancel his/her subscription ?
You can use a modify button to update the subscription. If want to cancel the subscription, you as the merchatn can cancel this or the buyer can cancel this as well. You can find more on using the modify and cancel features for subscriptions here. If your subsriptions start with I- instead of S-, you can also use the ManageRecurringPaymentsProfileStatus API to cancel the subscription as well.
Related
I'm trying to implement the PayPal Subscription API but I'm not sure about the process flow.
I use the react-paypal-js package to generate the subscription button.
The way the users are created on my website is only through the Paypal subscription.
The process is as follow:
The user choose a plan and click on the subscribe button
The PayPal window open and the user follows the subscription process on Paypal
The user is redirected to my website
Using webhooks or with the onApprove callback, I receive the newly created subscription, create a user on my website with the Paypal email address associated with the subscription.
It all works. My problem is that I need to check, before accepting the subscription, if I already have a local user with given email and in this case, I don't want to accept the subscription (as I would then have 2 subscriptions for the same user) and display a message saying that their is already an active (or suspended) subscription associated with the given email.
As far as I can tell, when the onApprove is called or the webhook is called, the subscription has already been processed and activated.
Thanks!
You don't have to design a system in which the PayPal email used to make the payment, and the email of the user used to log into your site, have a 1:1 relationship. Instead you can have the user log and create their account with you first (as they will always need that to manage something subscription-based) and then you will know there is no subscription associated with that user before displaying the PayPal Subscribe button. Then they can pay with any PayPal account (might be the same email, might be different)
As far as I can tell, when the onApprove is called or the webhook is called, the subscription has already been processed and activated.
That is the default behavior, yes. Per the above it shouldn't be ncessary, but you can change the subscription to start in an inactive state, and show a final review step on your site that will activate it via API. This is controlled by setting application_context -> user_action -> CONTINUE (vs default SUBSCRIBE_NOW). See the API reference for subscription create, and you would of course need to use the subscription activate API call as a final step after confirmation.
I implement a subscription site in which the subscriptions plans are monthly.
I use IPN to handle subscription events.
Now, If a recurring payment failed, I will get the relevant event and will cancel the subscription in my side.
But, what should I do when a user cancels his subscription via my site, and he still has time left in his subscription, and I want to cancel the subscription only in the end of the subscription period?
What can I do if the user cancels his subscription via PayPal and still has time left in his subscription?
In stripe you simply set "cancel_at_period_end=true" and then it's the same scenario.
There is no equivalent, PayPal doesn't keep track of anything for you. You'll receive cancel events whenever a profile is cancelled.
If you want to keep track of paid-through periods, that logic is up to you.
I am trying to set up a recurring payment with PayPal Subscription REST API. I'm following the Basic Integration in PayPal Developer Portal, using as suggested the Smart Payment Button. Besides, I'm using a WebHook to "capture" events related to subscription.
As the tutoria suggest, I created a Product and a Plan.
Now, I rendered the Smart Payment Button in a page (using the example), and when clicked it triggers the PayPal authorization flow. When the user complete the subscription process, the BILLING.SUBSCRIPTION.CREATED event is triggered. Later, also the PAYMENT.SALE.COMPLETED and BILLING.SUBSCRIPTION.ACTIVATED are triggered, and I receive data in my WebHook. Now, I have troubles in identifying which user activated the subscription. My idea is to pass a custom variable (with something allows me to identify the user) and retrive it later when the WebHook post me data, but I can't undertand how to do it. Anyway, is this the best way to do it? Or there is another solution?
I solved this using "custom_id" in the smart button:
return actions.subscription.create({
'plan_id': 'PLAN_ID',
'custom_id': 'CUSTOM_ID'
});
Then, I receive custom_id from webhooks or querying the subscription.
I'm working on a Paypal subscription based website.
I can not find an API method to get my subscribed clients and their subscription's status.
I only found a file to download manually, and it is not practical to check that way.
Basically what I want is to disable users when they cancel their subscriptions.
One way to go would be to use IPN to notify you when the subscription is cancelled and use the notification to trigger the the action. You can have a look at the documentation here.
as stated here: Detecting Paypal Subscription Cancellation api can be used to detect a paypal subscription cancellation. what about the opposite? using magento, i have code that creates the paypal subscription but when i cancel the subscription (in the cart), the cancellation is not passed to paypal and i must then go to paypal to cancel.
it would be great to avoid the extra step of double canceling and just only have to cancel from my cart (as admin and as customer via api sent to paypal)
You can use the ManageRecurringPaymentsProfileStatus API to cancel "I-" profiles. As far as if Magento supports this, or if there is a plugin that you can use I don't know of one off hand. However, it is possible. All that needs to happen is that your cart just needs to make API call.