-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IOS] requestPayment does not throw error if occure #134
Comments
Hi @triniwiz I did have a little bit time to investigate this issu .. the error come from here, the Completion handler is set to null instead of handling error. I've tested and it work StripePaymentDelegate.prototype.paymentContextDidCreatePaymentResultCompletion = function (paymentContext, paymentResult, completion) {
StripeStandardConfig.shared.backendAPI
.capturePayment(paymentResult.paymentMethod.stripeId, paymentContext.paymentAmount, createShippingMethod(paymentContext), createAddress(paymentContext.shippingAddress))
.then(function (value) {
completion(STPPaymentStatus.Success, null);
})
.catch(function (e) {
// this is the error
// completion(null createError('PaymentError', 100, e));
completion(STPPaymentStatus.Error, createError('PaymentError', 100, e));
});
}; |
According to the Stripe docs we should handle 3 type of responses :
For instance only the success is handled by this plugin, I suggest to update this part for IOS as below if you agree ? PS: I tested all 3 cases and it work as expected StripePaymentDelegate.prototype.paymentContextDidCreatePaymentResultCompletion = function (paymentContext, paymentResult, completion) {
StripeStandardConfig.shared.backendAPI
.capturePayment(paymentResult.paymentMethod.stripeId, paymentContext.paymentAmount, createShippingMethod(paymentContext), createAddress(paymentContext.shippingAddress))
.then(function (value) {
if(!value._native.lastPaymentError || value._native.lastPaymentError == "undefined") {
completion(STPPaymentStatus.Success, null);
return
}
completion(STPPaymentStatus.UserCancellation, null);
})
.catch(function (e) {
console.error("ERROR >> : paymentContextDidCreatePaymentResultCompletion : ", e);
completion(STPPaymentStatus.Error, createError('PaymentError', 100, e));
});
}; |
fixed with #141 |
Hi @triniwiz
In IOS standard implementation, requestPayment will return always success (via the listener) even if createPaymentSession dont return a payment intent at all!
I've tried to reject a promise into capturePayment method and it return always success.
The text was updated successfully, but these errors were encountered: