Search code examples
flutterpayment-gatewaypaymentpayment-processingpayout

payment gateway transfer/withdraw request from paystack to customers in flutter


I am making app where parents and students look up for tutors and hire them. I have set different pricing for tutors. So when student/parent pay the teacher suppose 500 NGN. How am I gonna make the tutor to request the withdraw/ transfer of money from paystack to his account. For making payments i am using package here is my code where student/parent pay the teacher. I just want tutor to make the withdraw/transfer request from paystack.

..setSecretKey("SECRET-KEY")
      ..setAmount(int.parse(widget.price + '00'))
      ..setReference(DateTime.now().millisecondsSinceEpoch.toString())
      ..setCurrency("NGN")
      ..setEmail("[email protected]")
      ..setFirstName("Hammas")
      ..setLastName("Ali")
      ..setMetadata(
        {
          "custom_fields": [
            {
              "value": "snapTask",
              "display_name": "Payment to",
              "variable_name": "payment_to"
            }
          ]
        },
      )
      ..onSuccesful(_onPaymentSuccessful)
      ..onPending(_onPaymentPending)
      ..onFailed(_onPaymentFailed)
      ..onCancel(_onPaymentCancelled)
      ..initialize();

Solution

  • You can create a separate app for the teachers so that they can upload their banking details and request payment.

    Once the parent pays the fee you can update the wallet amount of the teacher (in your database). Whenever the teacher want payout you can use the bank details stored in the database and send API request or use their SDK to transfer the amount to the teachers bank A/C.

    Flowchart: Parents app enter image description here

    Teachers app enter image description here

    Note: Im not familiar with Paystack and im writing it in the assumtion it has provision to send money via API or SDK