django-payments icon indicating copy to clipboard operation
django-payments copied to clipboard

(WIP) PayPal subscribtions

Open PetrDlouhy opened this issue 2 years ago • 3 comments

This is partially working implementation of PayPal subscriptions. I was able to manage subscription creation, getting state and cancelling. This is based subscription support drafted in #217.

Although I was able to successfully manage communication with PayPal, I have got stuck and I don't know how to continue at this point. The main problems are:

PayPal requires setting plan_id and having Plan created at the time of creating the Subscription. This is not required when using Subscription button (like django-paypal does). It brings in whole lot of problems - the price can't be changed per user, it requires implementer to set up the Plans on PayPal and maintain consistency with server settings (especially if django-payments are used with multiple providers).

Getting notification of the payments I don't know how to capture the recurring payments. With PayPal Subscription buttons PayPal sends notification about the payment. I didn't find how to do that with API. There also might be possibility to check the Subscriptions through the API and check their (possibly changed) expiration.

PetrDlouhy avatar Oct 27 '21 14:10 PetrDlouhy

Codecov Report

Merging #274 (b8360f6) into master (10b749a) will decrease coverage by 1.33%. The diff coverage is 59.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #274      +/-   ##
==========================================
- Coverage   79.92%   78.58%   -1.34%     
==========================================
  Files          28       28              
  Lines        1783     1868      +85     
  Branches      212      223      +11     
==========================================
+ Hits         1425     1468      +43     
- Misses        251      283      +32     
- Partials      107      117      +10     
Impacted Files Coverage Δ
payments/paypal/__init__.py 75.41% <52.94%> (-8.67%) :arrow_down:
payments/models.py 75.65% <71.42%> (-0.35%) :arrow_down:
payments/core.py 87.69% <100.00%> (+0.39%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 463f137...b8360f6. Read the comment docs.

codecov[bot] avatar Oct 27 '21 15:10 codecov[bot]

Now I was at least able to override the plan price. Although it is still not optimal, as it bothers user with creation of the plans on PayPal.

PetrDlouhy avatar Oct 27 '21 16:10 PetrDlouhy

I have re-implemented this in django-plans-paypal which uses subscription button from django-paypal. I have no time nor motivation to finish this PR, but I am leaving it open for volunteers to finish this.

PetrDlouhy avatar Jul 29 '22 08:07 PetrDlouhy