UsersPaymentsAirwallex

Airwallex is a multinational financial technology company offering financial services and software as a service

We implement airwallex in our side

Payment Intent Flow

  1. Create Payment Intent
    • When a user selects payment details (e.g., subscription terms) in the frontend, we initialize a payment intent.
  2. Update Payment Intent
    • If the user changes any information (like the subscription plan), we update the existing intent accordingly.
  3. Confirm Payment Intent
    • When the user is ready to pay, we confirm the payment intent. For one-time payments, this captures the funds immediately.
    • For upsell or recurring payments, we only authorize the payment without capturing the funds right away.
  4. Capture Payment
    • For upsell or recurring charges, we wait a specified duration (currently 6 days) before capturing the authorized payment. This was implemented in order to decrease fraud rate.

Scheduled Tasks (see Cloud Scheduler)

To handle delayed or recurring charges, we run two scheduled tasks every hour:

  1. Authorization Task (runs at the 15th minute of each hour)
    • Looks for any pending payment authorizations that are due: AirwallexPaymentAttempt.objects.filter(executed=False, date_due__lt=timezone.now())

    • These attempts are then processed to authorize the payment if it hasn’t already been executed and the due time has passed.

  2. Capture Task (runs at the 30th minute of each hour)
    • Searches for any confirmed payments that are scheduled to be captured: AirwallexPaymentConfirm.objects.filter(executed=False, date_due__lt=timezone.now())

    • If the current time is beyond the capture due date, the system captures the previously authorized funds.