binemmanuel / flutter_paystack_max

A Flutter package for making payments via Paystack Payment Gateway (https://paystack.com). Compatible with Android and iOS (Bank, Bank transfer, Card, USSD, Mobile Money, QR and EFT)
MIT License
14 stars 7 forks source link

PAYSTACK #6

Closed kelvinyashim closed 2 months ago

kelvinyashim commented 2 months ago

After paying the modal then waits to show that another modal is loading then it shows connection timed out

binemmanuel commented 2 months ago

After paying I doubt if there is a loading modal from the example but if you can provide more details (sample code, screenshots) bout this issue, it'll be helpful.

kelvinyashim commented 2 months ago

Hi yes theirs no modal. That was a error on my part However once the modal shows up on my debug console it says did not find Frame lockedcanvas

On Monday, August 19, 2024, Bin Emmanuel @.***> wrote:

After paying I doubt if there is a loading modal from the example but if you can provide more details (sample code, screenshots) bout this issue, it'll be helpful.

— Reply to this email directly, view it on GitHub https://github.com/binemmanuel/flutter_paystack_max/issues/6#issuecomment-2296535149, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4M7FNENWSVQAGE7OQDUIULZSHUWFAVCNFSM6AAAAABMVHWGJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJWGUZTKMJUHE . You are receiving this because you authored the thread.Message ID: @.***>

kelvinyashim commented 2 months ago

Also when i cancel payment it still pays And how do i handle that this is what i have so far

if (response.status) { await firestore.createOrder(order); cartProvider.clearCart(); ScaffoldMessenger.of(context).showSnackBar(const SnackBar( backgroundColor: Colors.green, content: Text('Payment successful!'), )); } else { ScaffoldMessenger.of(context).showSnackBar(SnackBar( backgroundColor: Colors.red, content: Text('Payment failed: ${response.message}'), )); }

binemmanuel commented 2 months ago

If you log/print the response you'll see that it returns

{
  "status": true,
  "message": "Verification successful",
  "data": {
    "id": 4100527671,
    "domain": "test",
    "status": "abandoned",
    "reference": "ps_1724349127944175"
  }
}

or

{
  "status": true,
  "message": "Verification successful",
  "data": {
    "id": 4100526349,
    "domain": "test",
    "status": "success",
    "reference": "ps_1724349091658435"
  }
}

The point is that Paystack always returns true for response.status and you should keep an eye on response.data.status instead. So, if you update to check for the status like below then you'll be good.

if (response.data.status == PaystackTransactionStatus.success) {
  // Payment was successful
}

PaystackTransactionStatus is an enum that has the following values

  1. PaystackTransactionStatus.reversed
  2. PaystackTransactionStatus.failed
  3. PaystackTransactionStatus.abandoned and
  4. PaystackTransactionStatus.success
kelvinyashim commented 2 months ago

thank you