Stripe-android: Adding a Card results in adding a source instead of Card.

Created on 2 Oct 2017  路  5Comments  路  Source: stripe/stripe-android

SDK version : compile 'com.stripe:stripe-android:5.0.0'

When i add a new card using com.stripe.android.view.PaymentMethodsActivity, clicking on "+ Add new card.." Stripe SDK creates a new source(visible on the strip dashboard), instead of a card.
iOS SDK creates an instance of a card.
Is this a feature, or intended behavior?
Thank you.

Most helpful comment

@mrmcduff-stripe sure, I do agree that source is more flexible. The only functionality that we lack at the moment is a way to delete a source in the Stripe dashboard. We can do that with a card, but not with a source. Is there any way how we can achieve that?

All 5 comments

It is a source of type Card. Sources are generally going to have more flexibility to do things within the Stripe API than Cards (eventually all payment sources will be Sources). We're moving to (very, very slowly) deprecate the use of Tokens in favor of Sources.

If there's any card-specific data that you need from the Source, you can call Source#getSourceTypeModel and it will return a SourceCardData that should have the data that you need. Is there anything you're trying to do with a Card that you can't do with a Source?

@mrmcduff-stripe sure, I do agree that source is more flexible. The only functionality that we lack at the moment is a way to delete a source in the Stripe dashboard. We can do that with a card, but not with a source. Is there any way how we can achieve that?

@mrmcduff-stripe any updates ?

@mrmcduff-stripe any response? I will create a new issue in case i don't get any response :) Just say there is no way of deleting sources if that's the case and all if fine.

Did this question have answers?
I am listing all card infos from Stripe Api..
https://api.stripe.com/v1/customers/cus_DzmEDPKEkGnNyg/sources
It results data array, but the source data from Android SDK and iOS data are different.

Here is the source data that added using "Add New Card..." in Android SDK.

{
    "id": "src_1D7sshCBreKY63BUIqCnQXxg",
    "object": "source",
    "amount": null,
    "card": {
        "exp_year": 2025,
        "exp_month": 12,
        "brand": "Visa",
        "country": "US",
        "cvc_check": "pass",
        "fingerprint": "m4Tb170K3DCkQsVf",
        "funding": "debit",
        "last4": "5556",
        "three_d_secure": "optional",
        "name": null,
        "address_line1_check": null,
        "address_zip_check": null,
        "tokenization_method": null,
        "dynamic_last4": null
    },
    "client_secret": "src_client_secret_DZ0uFKWdNIQrSvtbqXDErjBj",
    "created": 1536361011,
    "currency": null,
    "customer": "cus_DWusFkJVn0cLAQ",
    "flow": "none",
    "livemode": false,
    "metadata": {},
    "owner": {
        "address": null,
        "email": null,
        "name": null,
        "phone": null,
        "verified_address": null,
        "verified_email": null,
        "verified_name": null,
        "verified_phone": null
    },
    "statement_descriptor": null,
    "status": "chargeable",
    "type": "card",
    "usage": "reusable"
}

And here is the source data that added using "Add New Card..." in iOS SDK.

{
    "id": "card_1DX3OYCBreKY63BUZoNK7fI5",
    "object": "card",
    "address_city": null,
    "address_country": "US",
    "address_line1": null,
    "address_line1_check": null,
    "address_line2": null,
    "address_state": null,
    "address_zip": null,
    "address_zip_check": null,
    "brand": "Visa",
    "country": "US",
    "customer": "cus_DrCNgn56xhcIt1",
    "cvc_check": "pass",
    "dynamic_last4": null,
    "exp_month": 2,
    "exp_year": 2019,
    "fingerprint": "GFand6jjiybsq0xg",
    "funding": "credit",
    "last4": "4242",
    "metadata": {},
    "name": null,
    "tokenization_method": null
}

This gives a little mess when parsing these data to extract card info..
Not sure whether this is expected behavior.

Was this page helpful?
0 / 5 - 0 ratings