You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am using the sandbox environment to test khalti payment integration. The code seems to have worked for the first couple of times but afterwards the payment status returns 'pending' and the webview is not loading.
To Reproduce
I have used bloc to initialize khalti like this:
class KhaltiBloc extends Bloc<KhaltiEvent, KhaltiState> {
KhaltiBloc() : super(KhaltiInitial()) {
on<InitializeKhalti>(_initializeKhalti);
}
PaymentResult? paymentResult;
FutureOr<void> _initializeKhalti(
InitializeKhalti event, Emitter<KhaltiState> emit) async {
emit(KhaltiLoading());
final context = event.context;
final payConfig = KhaltiPayConfig(
publicKey:
event.publicKey, // This is a dummy public key for example purpose
pidx: event.pidx,
environment: Environment.test,
);
try {
final khalti = await Khalti.init(
enableDebugging: true,
payConfig: payConfig,
onPaymentResult: (paymentResult, khalti) {
log('--pay info ------');
log(paymentResult.toString());
paymentResult = paymentResult;
khalti.close(context);
},
onMessage: (
khalti, {
description,
statusCode,
event,
needsPaymentConfirmation,
}) async {
log(
'Description: $description, Status Code: $statusCode, Event: $event, NeedsPaymentConfirmation: $needsPaymentConfirmation',
);
khalti.close(context);
},
onReturn: () {
log('Successfully redirected to return_url.');
},
);
emit(KhaltiInitalizeSuccess(khalti: khalti));
} catch (e) {
emit(KhaltiInitializeError());
}
}
}
Note
the test credentials I used the first few times were:
Test Khalti ID 9800000005
Test MPIN 1111
Test OTP 987654
The text was updated successfully, but these errors were encountered:
Try generating a new pidx, then initiate a new purchase. The payment process may not have been verified on the testing server so it might have returned that response.
With a new pidx, the payment status should not return pending as its status.
Describe the bug
I am using the sandbox environment to test khalti payment integration. The code seems to have worked for the first couple of times but afterwards the payment status returns 'pending' and the webview is not loading.
To Reproduce
I have used bloc to initialize khalti like this:
Note
the test credentials I used the first few times were:
Test Khalti ID 9800000005
Test MPIN 1111
Test OTP 987654
The text was updated successfully, but these errors were encountered: