question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing tokenId from stripe.paymentRequestWithCardForm() response

See original GitHub issue

Before I have submitted the issue

[x] I have read an installation guide
[x] I know that for an iOS I need to install pods because I’ve read the installation guide
[x] I have read a linking guide and checked that everything is OK like in manual linking guide
[x] I know that before using tipsi-stripe I need to set options for my app as described in usage guide

The problem

stripe.paymentRequestWithCardForm() is no longer returning tokenId

It returns the following:

billingDetails: {...}
card: {...}
created: 1575564470
customerId: null
id: "pm_..."
livemode: false
type: "card"

tokenId returns correctly if I hardcode the card details using stripe.createTokenWithCard({number: '4242424242424242', expMonth: 11, expYear: 27, cvc: '223'})

I would ideally prefer to use the prebuilt component since it handles validation etc.

Code To Reproduce Issue (Good To Have)

stripe.paymentRequestWithCardForm()
    .then(res => {
        console.log(res.tokenId) <=== undefined
    })
    .catch(error => {
        console.log(error)
    })

Environment

  • tipsi-stripe version: 8.0.0-beta.7
  • Last tipsi-stripe version where the issue was not reproduced (if applicable): Can’t reproduce even when rolling back to stable npm version
  • iOS or Android: Android
  • OS version: 9
  • React-Native version: 0.61.2
  • (Android only) com.google.firebase:firebase-core version: N/A
  • (Android only) com.google.android.gms:play-services-base version:

Links to logs and sources

For Android, please provide the following sections from android/app/build.gradle:

  • android.compileSdkVersion 28
  • android.buildToolsVersion 28.0.3
  • android.defaultConfig.minSdkVersion 19
  • android.defaultConfig.targetSdkVersion 28
  • android.defaultConfig.multiDexEnabled (if exists) Y

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

4reactions
jamesl1001commented, Dec 11, 2019

FIXED

paymentRequestWithCardForm() now returns the payment method token (response.id) rather than the card token (response.tokenId) so there is now no need to pass the card token to createPaymentMethod() in order to retrieve the payment method token.

3reactions
chetanCyquentcommented, Aug 25, 2020

Hi I am struggling with same in v8.0.0-beta.10 for getting token. But i am receiving payment method id. e.g looking for “tok_XXXX” but getting “pm_XXXX”

And Backend(PHP) is looking for “tok_XX” to complete the payment, so payment is failing at backend.

Please guide me for same to get it worked.

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Stripe Firebase - Test token working but test card ...
The solution was to change: setToken(token). to setToken(token.tokenId).
Read more >
Error codes | Stripe Documentation
The bank account number provided is invalid (e.g., missing digits). ... Check the disputes documentation to learn how to respond to the dispute....
Read more >
Stripe API reference – Tokens – curl
Creates a single-use token that represents a credit card's details. This token can be used in place of a credit card with any...
Read more >
Create a card token – curl - Stripe API reference
Creates a single-use token that represents a credit card's details. This token can be used in place of a credit card with any...
Read more >
Stripe API reference – Errors – curl
Stripe uses conventional HTTP response codes to indicate the success or ... Codes in the 5xx range indicate an error with Stripe's servers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found