Princewil / flutter_paystack_plus

A package for Implement payment using paystack - Compatible on Android, iOS and Web
Apache License 2.0
6 stars 8 forks source link

Payment reference call back #6

Closed Adebayo2016 closed 1 year ago

Adebayo2016 commented 1 year ago

cannot retrieve payment reference using the mobile widget

Princewil commented 1 year ago

Hmm, I don’t really get this. I believe your payment ref was stored on a var before use, meaning you can still call it even after a successful transaction.

please do explain further

On Sat, 16 Sep 2023 at 15:07, Walexhino @.***> wrote:

cannot retrieve payment reference using the mobile widget

— Reply to this email directly, view it on GitHub https://github.com/Princewil/flutter_paystack_plus/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWWTE5LBELUPLXHRTJOTCDX2WXBXANCNFSM6AAAAAA425H5D4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Adebayo2016 commented 1 year ago

Alright, i figured that out , but my new issue here is that , the Onsuccess doesnt navigate anywhere.

Princewil commented 1 year ago

The onsuccess is a callback. You tell it what to do. If you want to navigate them pass the function for navigation there.

On Mon, 18 Sep 2023 at 23:40, Walexhino @.***> wrote:

Alright, i figured that out , but my new issue here is that , the Onsuccess doesnt navigate anywhere.

— Reply to this email directly, view it on GitHub https://github.com/Princewil/flutter_paystack_plus/issues/6#issuecomment-1724559305, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWWTEZC57SSVY2I2EYG6ATX3DEXFANCNFSM6AAAAAA425H5D4 . You are receiving this because you commented.Message ID: @.***>

Adebayo2016 commented 1 year ago

Thank you for your time on this , here is my code can you take a look at it .

void paymentPage(BuildContext context, ref) async { var amountTopay = amountToInvestController.text.toAmount() * 100; try { return await FlutterPaystackPlus.openPaystackPopup( publicKey: "sk_test_3691e13a493cc2c278", context: context, secretKey: "sk_test_3691e13a493ccce86d8", currency: 'NGN', customerEmail: userRepo.loginData.email!, amount: amountTopay.toString(), reference: _transref, onClosed: () { debugPrint('Could\'nt finish payment'); }, onSuccess: () { Navigator.pushReplacementNamed(context, RouteName.investmentSuccess); debugPrint('Payment successful'); },

  );
} catch (e) {
  debugPrint(e.toString());
}

}

Princewil commented 1 year ago

Cool👍. But you passed your secret key twice. It should be your secret and public key.

PS: Don’t share your keys publicly.

On Tue, 19 Sep 2023 at 00:25, Walexhino @.***> wrote:

Thank you for your time on this , here is my code can you take a look at it .

void paymentPage(BuildContext context, ref) async { var amountTopay = amountToInvestController.text.toAmount() * 100; try { return await FlutterPaystackPlus.openPaystackPopup( publicKey: "sk_test_3691e13a493ccce86d79f4c65f00e32d1322c278", context: context, secretKey: "sk_test_3691e13a493ccce86d79f4c65f00e32d1322c278", currency: 'NGN', customerEmail: userRepo.loginData.email!, amount: amountTopay.toString(), reference: _transref, onClosed: () { debugPrint('Could'nt finish payment'); }, onSuccess: () { Navigator.pushReplacementNamed(context, RouteName.investmentSuccess); debugPrint('Payment successful'); },

); } catch (e) { debugPrint(e.toString()); }

}

— Reply to this email directly, view it on GitHub https://github.com/Princewil/flutter_paystack_plus/issues/6#issuecomment-1724612551, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWWTE45QIWKXMRTBBSEEKDX3DKAFANCNFSM6AAAAAA425H5D4 . You are receiving this because you commented.Message ID: @.***>

Adebayo2016 commented 1 year ago

could that be the reason my onSuccess is not navigating ?

Princewil commented 1 year ago

Yup. Could be.

If after passing your public key and doing everything right, the onsuccess is not called then it means there is a bug on the package. So you just let me know. I will fix it.

On Tue, 19 Sep 2023 at 02:34, Walexhino @.***> wrote:

could that be the reason my onSuccess is not navigating ?

— Reply to this email directly, view it on GitHub https://github.com/Princewil/flutter_paystack_plus/issues/6#issuecomment-1724701704, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWWTE7SKUB5J2H5SD2IJFTX3DZBPANCNFSM6AAAAAA425H5D4 . You are receiving this because you commented.Message ID: @.***>

Princewil commented 1 year ago

I will close this issue for now. Reopen if need be.