Always immediately capture payments.
This commit is contained in:
parent
ed1087d9d3
commit
26b249d48d
1 changed files with 18 additions and 24 deletions
|
@ -105,32 +105,26 @@ def process_card(request, form, inv):
|
||||||
conference.title, inv.invoice.id
|
conference.title, inv.invoice.id
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
charge = actions.charges.create(
|
||||||
charge = actions.charges.create(
|
amount_to_pay,
|
||||||
amount_to_pay,
|
customer,
|
||||||
customer,
|
currency=CURRENCY,
|
||||||
currency=CURRENCY,
|
description=description,
|
||||||
description=description,
|
capture=True,
|
||||||
capture=False,
|
)
|
||||||
)
|
|
||||||
|
|
||||||
receipt = charge.stripe_charge.receipt_number
|
receipt = charge.stripe_charge.receipt_number
|
||||||
if not receipt:
|
if not receipt:
|
||||||
receipt = charge.stripe_charge.id
|
receipt = charge.stripe_charge.id
|
||||||
reference = "Paid with Stripe receipt number: " + receipt
|
reference = "Paid with Stripe receipt number: " + receipt
|
||||||
|
|
||||||
# Create the payment object
|
# Create the payment object
|
||||||
models.StripePayment.objects.create(
|
models.StripePayment.objects.create(
|
||||||
invoice=inv.invoice,
|
invoice=inv.invoice,
|
||||||
reference=reference,
|
reference=reference,
|
||||||
amount=charge.amount,
|
amount=charge.amount,
|
||||||
charge=charge,
|
charge=charge,
|
||||||
)
|
)
|
||||||
except StripeError as e:
|
|
||||||
raise e
|
|
||||||
finally:
|
|
||||||
# Do not actually charge the account until we've reconciled locally.
|
|
||||||
actions.charges.capture(charge)
|
|
||||||
|
|
||||||
inv.update_status()
|
inv.update_status()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue