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

collectPaymentMethod() faild, Collect payment method call after retrievePaymentIntent() asynchronously error occur >> VALUE FOR PAYMENTINTENT CANNOT BE CAST FROM STRING TO ReadableNativeMap. stripe terminal using the tap to pay(Simulated mode: YES) React native app, I got an error. #675

Open
abhijitCN opened this issue Apr 24, 2024 · 5 comments

Comments

@abhijitCN
Copy link

abhijitCN commented Apr 24, 2024

** the error **
When I tried to collect the payment method retrievePaymentIntent(clientSecret) and then call the collectPaymentMethod({ paymentIntent: paymentIntent.id }) method but got the error >> VALUE FOR PAYMENTINTENT CANNOT BE CAST FROM STRING TO ReadableNativeMap
stripe terminal using the tap to pay(Simulated mode: YES) React native app, I got an error.
only retrievePaymentIntent(clientSecret) this function gives response, but whenever adding collectPaymentMethod({ paymentIntent: paymentIntent.id }) this function gating the error
If any other way to modify my payment function @nazli-stripe please suggest.

To Reproduce
Steps to reproduce the behavior:

const payment = async () => {
const { paymentIntent: Intent, error} = await retrievePaymentIntent(clientSecret);
if (error) {
console.log('Error >> ', error);
return;
}
console.log('Intent >> ', Intent);
//setProcessId(paymentIntent.id);
if (Intent?.id) {
const { paymentIntent:pay, err:error } = await collectPaymentMethod({ paymentIntent: paymentIntent.id });
console.log('pay >> ', pay);
}
if (err) {
console.log('err >> ', err);
return;
}
};

Expected behavior
I use the asynchronous function payment where two functions call one after another but gating this error >> VALUE FOR PAYMENTINTENT CANNOT BE CAST FROM STRING TO ReadableNativeMap
Screenshots
If applicable, add screenshots to help explain your problem.

Stripe Terminal React Native SDK version
@

  • (e.g., ^0.0.1-beta.16)
  • Simulated Device: [Pixel-5]
  • OS: [mac os - Sonoma]
    Screenshot_1713784529
@abhijitCN abhijitCN changed the title collectPaymentMethod() faild, Collect payment method call after retrievePaymentIntent() asynchronously error occur >> VALUE FOR PAYMENTINTENT CANNOT BE CAST FROM STRING TO ReadableNativeMap collectPaymentMethod() faild, Collect payment method call after retrievePaymentIntent() asynchronously error occur >> VALUE FOR PAYMENTINTENT CANNOT BE CAST FROM STRING TO ReadableNativeMap. stripe terminal using the tap to pay(Simulated mode: YES) React native app, I got an error. Apr 24, 2024
@nazli-stripe
Copy link
Collaborator

nazli-stripe commented Apr 25, 2024

The SDK doesn't provide a capturePaymentIntent method as that should be handled on the backend. What method from which Stripe SDK are you calling exactly This seems like a potential integration issue for which I recommend reaching out to [email protected] to get assistance faster.

@abhijitCN
Copy link
Author

abhijitCN commented Apr 25, 2024

@nazli-stripe sorry,it is collectPaymentMethod({ paymentIntent: paymentIntent.id }) whenever i call collectPaymentMethod({ paymentIntent: paymentIntent.id }) this method after retrievePaymentIntent(clientSecret) I gating the error.

@nazli-stripe
Copy link
Collaborator

for collectPaymentMethod you have to pass the full PaymentIntent object you received from the retrievePaymentIntent method, not just the id: https://stripe.dev/stripe-terminal-react-native/api-reference/index.html#CollectPaymentMethodParams

@abhijitCN
Copy link
Author

@nazli-stripe thank you so much.
please help me in another section. What am I getting from collectPaymentMethod() method will I pass the Total object in,
confirmPaymentIntent() method or only the id from the object because I am gatting the error ==>
{"code": "INTEGRATION_ERROR.INVALID_REQUIRED_PARAMETER", "message": "The PaymentIntent is missing sdkUuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent."}
in the below code in collectPayment object, sdkUuid is present

const processPayment = async () => {
const { paymentIntent: Intent, error} = await retrievePaymentIntent(IntentId);
if (error) {
console.log('Error >> ', error);
return;
}
console.log('Intent >> ', Intent);
if (Intent) {
console.log(' inside collectPaymentMethod >> ');
const { paymentIntent:collectPayment, error:err } = await collectPaymentMethod({ paymentIntent: Intent });
console.log('collectPayment >> ', collectPayment);
if(collectPayment){
const { paymentIntent: confirmPaymentIntent, error: confirmError } = await
confirmPaymentIntent(confirmPaymentResult);
console.log('confirmPaymentIntent success >> ', confirmPaymentIntent);
if (confirmError) {
console.log('confirmPaymentIntent error >> ', confirmError);
return;
}
}
if (err) {
console.log('err >> ', err);
return;
}
}
};

@zaidmaknojia
Copy link

I am getting the same error while trying to use confirmPaymentIntent. The object returned by collectPaymentMethod() is undefined for me. Is this because I am using the test api key?

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

No branches or pull requests

3 participants