Skip to content
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

Populate PaymentIntent when there is an error after calling collectPaymentMethod(), confirmPaymentIntent(), etc. #674

Closed
willwelo opened this issue Apr 23, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@willwelo
Copy link

Is your feature request related to a problem? Please describe.
When calling collectPaymentMethod() or confirmPaymentIntent(), etc. where the return value is a promise of the type PaymentIntentResultType and an error occurs, paymentIntent property is undefined.

confirmPaymentIntent: (paymentIntent: PaymentIntent.Type) => Promise<import("../types").PaymentIntentResultType>;

export declare type PaymentIntentResultType = { paymentIntent: PaymentIntent.Type; error?: undefined; } | { paymentIntent?: undefined; error: StripeError; };

So if there is an error paymentIntent is not set.
It would be useful to know which state the payment intent is in after the error has occurred.

This functionality seems to be present for other approaches per the documentation
Handle Failures

@nazli-stripe nazli-stripe added the enhancement New feature or request label Apr 23, 2024
@abhijitCN
Copy link

and you also get this error? calling retrievePaymentIntent(IntentId) then at the time of calling collectPaymentMethod({ paymentIntent: paymentIntent?.id }) this function I gating this error.

const processPayment = async () => {
try {
const { paymentIntent, error } = await retrievePaymentIntent(IntentId);
if (error) {
console.log('retrievePaymentIntent Error >> ', error);
return;
}
console.log('paymentIntent?.id for next phase >> ', paymentIntent?.id);
if (paymentIntent?.id) {
const { paymentIntent: payment, error: err } = await collectPaymentMethod({ paymentIntent: paymentIntent?.id });
console.log('Payment Pass >> ', payment);
if (err) {
console.log('Payment Error >> ', err);
return;
}
} else {
console.log('No paymentIntent ID found');
}
} catch (error) {
console.log('An error occurred during the payment process:', error);
}
};

Screenshot_1713784529

@nazli-stripe
Copy link
Collaborator

@willwelo being added in #707

@nazli-stripe
Copy link
Collaborator

@willwelo
Copy link
Author

@willwelo this has been added in the beta.19 release: https://github.com/stripe/stripe-terminal-react-native/releases/tag/v0.0.1-beta.19

Awesome, thank you! Will upgrade and start using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants