-
Notifications
You must be signed in to change notification settings - Fork 2
Subscription_payments
Victor Porton edited this page Oct 1, 2018
·
3 revisions
Subscription payments are created like regular payments but with SubscriptionItem
instead of SimpleItem
and SubscriptionTransaction
instead of SimpleTransaction
:
item = SubscriptionItem.objects.create(product=product,
currency='EUR',
price=14.35,
payment_period_unit=Period.UNIT_MONTHS,
payment_period_count=1,
trial_period_unit=Period.UNIT_MONTHS,
trial_period_count=2)
purchase = SubscriptionPurchase(item=item, trial=True)
purchase.set_payment_date(datetime.date.today() + datetime.timedelta(days=30))
purchase.start_trial() # call only if trial_period_count != 0
purchase.save()
transaction = SubscriptionTransaction.objects.create(processor=processor, purchase=purchase)
return form.make_purchase_from_form(hash, transaction)
After creation of item call item.set_payment_date()
. If the trial period is non-zero, call also item.start_trial()
.