Comments (4)
@cimplesid-tekkon thank you for your feedback. We are still working on improving our docs and shall do so through your inputs.
About conveying messages, please check all the information being passed via onMessage callback. It also sends info about whether or not the client should re-verify the payment status on their own in certain scenarios. This was done with security concerns in mind.
Thank you.
from checkout-sdk-flutter.
Another code sample to reproduce:
//get pidx and store in pixres
var pidx = pixres["pidx"];
if (pidx != null) {
final payConfig = KhaltiPayConfig(
publicKey: somekey,
pidx: pidx,
openInKhalti: false,
returnUrl: Uri.parse('https://hamoshare.com.np'),
environment: kDebugMode ? Environment.test : Environment.prod,
);
var khalti = Khalti.init(
enableDebugging: kDebugMode,
payConfig: payConfig,
onPaymentResult: (paymentResult, khalti) {
hprint("onPaymentResult", "payment");
hprint(paymentResult.toString());
setState(() {
this.paymentResult = paymentResult;
});
khalti.close(context);
},
onMessage: (
khalti, {
description,
statusCode,
event,
needsPaymentConfirmation,
}) async {
hprint("onMessage:", "payment");
hprint(
'Description: $description, Status Code: $statusCode, Event: $event, NeedsPaymentConfirmation: $needsPaymentConfirmation',
"payment");
khalti.close(context);
},
onReturn: () =>
hprint('Successfully redirected to return_url.', "payment"),
);
var cart = await khalti;
cart.open(context);
```
from checkout-sdk-flutter.
Update on ^1.0.0-dev.4
- Issue 1: encounters unnecessary networkFailure event causing no network UI even when network available
- issue 2: no onPaymentResult callback is fired (unable to track a payment)
final payConfig = KhaltiPayConfig(
publicKey: "",
pidx: pidx,
openInKhalti: false,
returnUrl: Uri.parse('https://hamroshare.com.np'),
environment: kDebugMode ? Environment.test : Environment.prod,
);
var khalti = Khalti.init(
enableDebugging: kDebugMode,
payConfig: payConfig,
onPaymentResult: (paymentResult, khalti) {
hprint("onPaymentResult", "HSpaymentModule");
hprint(paymentResult.toString());
setState(() {
this.paymentResult = paymentResult;
});
khalti.close(context);
},
onMessage: (
khalti, {
description,
statusCode,
event,
needsPaymentConfirmation,
}) async {
hprint("onMessage:", "HSpaymentModule");
hprint(
'Description: $description, Status Code: $statusCode, Event: $event, NeedsPaymentConfirmation: $needsPaymentConfirmation',
"HSpaymentModule");
khalti.close(context);
},
onReturn: () => hprint(
'Successfully redirected to return_url.', "HSpaymentModule"),
);`
-----------------------------------
Log after complete flow
-----------------------------------
[HSpaymentModule] Successfully redirected to return_url.
[HSpaymentModule] onMessage:
[HSpaymentModule] Description: null, Status Code: 0, Event: KhaltiEvent.networkFailure, NeedsPaymentConfirmation: true
[HSpaymentModule] onMessage:
[HSpaymentModule] Description: Khalti payment page disposed, Status Code: null, Event: KhaltiEvent.kpgDisposed, NeedsPaymentConfirmation: true
from checkout-sdk-flutter.
@biplab-khalti Yeah issue was on my end and I think doc can be improved so that others do not encounter the same issue
- Return URL
current documentation (The URL to redirect after payment is successful.)
but it does not say, it should be the same as in the backend param - use https URL and do not have "/" at the end of the URL causes a crash while redirecting and exposes the API on 404 page
possible package improments
- injectable payconfig (not needed in initialization of Configuration
- separate callback for error cases because when something is wrong and onPaymentResult is not fired it's hard to figure out what is wrong. Example: when publicKey is mismatched and lookup API fails. the payment is completed but will not get success callback
from checkout-sdk-flutter.
Related Issues (6)
- The SDK don't feels like Mobile. Also due to less practical documentation, hard to figure it out. HOT 1
- Facing same issues regarding not triggered onPaymentResult call back function . HOT 5
- Version not compatible with the latest firebase dependencies HOT 1
- SDK Version Dependency problem
- Cannot Get Login interface in khalti_checkout_flutter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from checkout-sdk-flutter.