File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -799,15 +799,20 @@ def get_context_data(self, **kwargs):
799799 cancel_url = self .object .payload ["data" ]["account" ]["url" ]
800800
801801 purchase_data = self .object .payload ["marketplace_purchase" ]
802- if purchase_data ["billing_cycle" ] == "monthly" :
802+
803+ # try yearly billing first
804+ subscription_price = (
805+ purchase_data ["plan" ].get ("yearly_price_in_cents" , 0 ) // 100
806+ )
807+ # default to monthly price next. FastSpring yearly billing subscriptions
808+ # also send the price in this field
809+ if subscription_price == 0 :
803810 subscription_price = (
804811 purchase_data ["plan" ].get ("monthly_price_in_cents" , 0 ) // 100
805812 )
813+ if purchase_data ["billing_cycle" ] == "monthly" :
806814 subscription_period = _ ("mo" )
807815 elif purchase_data ["billing_cycle" ] == "yearly" :
808- subscription_price = (
809- purchase_data ["plan" ].get ("yearly_price_in_cents" , 0 ) // 100
810- )
811816 subscription_period = _ ("yr" )
812817
813818 subscription_price = int (subscription_price )
You can’t perform that action at this time.
0 commit comments