Tipsi-stripe: Problems creating source

Created on 22 Jan 2018  路  13Comments  路  Source: tipsi/tipsi-stripe

I'm trying to create a source id to send to backend which is expecting it in this format: src_1Bbn7iEnsJaaAUJe1UZASnCd

However I'm getting this error when trying to create it with createSourceWithParams using a test card number:
No such source: card_1Bn6l9EnsJaaAUJeE8ZWQ0uU

This is my code, I probably missed something. I retrieve the card Id from paymentRequestWithCardForm(), apparently this is not correct. I'm not sure what other card ID is expected. Any help is appreciated.
```
stripe.paymentRequestWithCardForm()
.then((data) => {

    if(data.card) {
      const cardId = data.card.cardId

      stripe.createSourceWithParams({
        type: 'threeDSecure',
        currency: 'eur',
        amount: 1000,
        name: 'Test',
        returnURL: 'xxxx-stripe://stripe-redirect',
        card: cardId
      })
    }

  })

}
```

Most helpful comment

We can just use REST API

stripe

{
    "id": "src_1CG3vsIoYsg4cTtdYPOIoge1",
    "object": "source",
    "amount": null,
    "client_secret": "src_client_secret_CfOjaD1IRtt1m9PjGvovEjjg",
    "created": 1523533780,
    "currency": null,
    "flow": "none",
    "livemode": false,
    "metadata": {},
    "owner": {
        "address": {
            "city": null,
            "country": null,
            "line1": null,
            "line2": null,
            "postal_code": "42424",
            "state": null
        },
        "email": null,
        "name": "wer",
        "phone": null,
        "verified_address": null,
        "verified_email": null,
        "verified_name": null,
        "verified_phone": null
    },
    "statement_descriptor": null,
    "status": "chargeable",
    "type": "card",
    "usage": "reusable",
    "card": {
        "exp_month": 4,
        "exp_year": 2024,
        "address_zip_check": "unchecked",
        "brand": "Visa",
        "card_automatically_updated": false,
        "country": "US",
        "cvc_check": "unchecked",
        "funding": "credit",
        "last4": "3063",
        "three_d_secure": "required",
        "address_line1_check": null,
        "tokenization_method": null,
        "dynamic_last4": null
    }
}

And we can see:
Source - "id": "src_1CG3vsIoYsg4cTtdYPOIoge1",
And - "three_d_secure": "required",

Next, we can use this Source instead Card.
Also we can create new Source with Three D Secure on the Backend side

All 13 comments

Hi, @rom1k! Can you show full error log? And tell me where it happens?

@isnifer
Full error:

Error: No such source: card_1Bn7dSEnsJaaAUJe9wetuSvT
    at createErrorFromErrorData (NativeModules.js:123)
    at NativeModules.js:80
    at MessageQueue.__invokeCallback (MessageQueue.js:347)
    at MessageQueue.js:137
    at MessageQueue.__guard (MessageQueue.js:265)
    at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:136)
    at debuggerWorker.js:72

It happens on createSourceWithParams().catch (not included in the snippet above)

I am guessing that the createSourceWithParams method expects not a card_* but a src_*.
The problem here is that tipsi-stripe library does not support createSourceWithParams with type: card.
Stripe.js requires you to create s Source with type card, before you are able to create a Source with type threeDsecure. But with tipsi-stripe this is not supported.

I have the same problem, and hope this will be prioritized.

@santiagofm any ideas?

Hey! Is this ios or android ?

@santiagofm This is for iOS.

Hi,

For Android as well.

We are currently facing the same issue and the analysis of @dextorion is correct.

The paymentRequestWithCardForm is always returning a token, which is correct most of the time but not for 3dsecure.

We are in the process of fixing this inside thzt method by calling createToken or createSource depending on input param.

We'd be happy to propose PR for Android

Hi, What are the successes?
When will 3d Secure be implemented?

@ratkus91 when someone will create a PR

After a little bit of investigation, I came to the conclusion that creating a source from the card widget might not be the solution

Indeed, the behavior of the card widget is not the same between Android and ios so while it will work on Android it will not on ios

What you can do instead is creating a card source from the token on your backend. That's how I finally did.

@ydecoux What you can do instead is creating a card source from the token on your backend. That's how I finally did.

Can you show your code?

stripe.sources.create({
    amount        : 1099,
    currency      : 'eur',
    type          : 'three_d_secure',
    three_d_secure: { card },
    redirect      : { return_url: 'https://shop.example.com/crtA6B28E1' },
})

I am getting an error:

{ code: 'resource_missing',
     doc_url: 'https://stripe.com/docs/error-codes#resource-missing',
     message: 'No such source: card_1CFyrlIoYsg4cTtdYKlWnxTI',
     param: 'three_d_secure[card]',
     type: 'invalid_request_error',
     statusCode: 404,
     requestId: 'req_BJJX4MRQdTVUwO' },
  requestId: 'req_BJJX4MRQdTVUwO',
  statusCode: 404 }

We can just use REST API

stripe

{
    "id": "src_1CG3vsIoYsg4cTtdYPOIoge1",
    "object": "source",
    "amount": null,
    "client_secret": "src_client_secret_CfOjaD1IRtt1m9PjGvovEjjg",
    "created": 1523533780,
    "currency": null,
    "flow": "none",
    "livemode": false,
    "metadata": {},
    "owner": {
        "address": {
            "city": null,
            "country": null,
            "line1": null,
            "line2": null,
            "postal_code": "42424",
            "state": null
        },
        "email": null,
        "name": "wer",
        "phone": null,
        "verified_address": null,
        "verified_email": null,
        "verified_name": null,
        "verified_phone": null
    },
    "statement_descriptor": null,
    "status": "chargeable",
    "type": "card",
    "usage": "reusable",
    "card": {
        "exp_month": 4,
        "exp_year": 2024,
        "address_zip_check": "unchecked",
        "brand": "Visa",
        "card_automatically_updated": false,
        "country": "US",
        "cvc_check": "unchecked",
        "funding": "credit",
        "last4": "3063",
        "three_d_secure": "required",
        "address_line1_check": null,
        "tokenization_method": null,
        "dynamic_last4": null
    }
}

And we can see:
Source - "id": "src_1CG3vsIoYsg4cTtdYPOIoge1",
And - "three_d_secure": "required",

Next, we can use this Source instead Card.
Also we can create new Source with Three D Secure on the Backend side

You got it :)
However, the three_d_secure source should be created using tipsi. The reason is that tipsi is already taking care of the redirect flow.

Was this page helpful?
0 / 5 - 0 ratings