stripe/stripe-terminal-react-native

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.

Opened this issue · 5 comments

** 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

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 support@stripe.com to get assistance faster.

@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.

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

@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;
}
}
};

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?