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

feat: add currency support when creating card tokens #862

Merged
merged 3 commits into from
Mar 24, 2022

Conversation

charliecruzan-stripe
Copy link
Collaborator

Summary

Add support for setting currency in a card token

Motivation

https://jira.corp.stripe.com/browse/RUN_DX-1037

Testing

  • I tested this manually
  • I added automated tests

Documentation

Select one:

  • I have added relevant documentation for my changes.
  • This PR does not result in any developer-facing changes.

@charliecruzan-stripe charliecruzan-stripe merged commit 6613f76 into master Mar 24, 2022
@charliecruzan-stripe charliecruzan-stripe deleted the charliecruzan-currency-token branch March 24, 2022 21:52
@LukeKosner
Copy link

Hi @charliecruzan-stripe,

I have the following integration in order to upload a debit card for Stripe Connect payouts:

  async function capturePayoutCard() {
    createToken({
      card,
      currency: "usd",
    })
      .then(({ token }) => {
        console.log(token);
      })
    return (
      <StripeProvider
        ...
      >
        <SafeAreaView>
          <CardField
            postalCodeEnabled
            onCardChange={(cardDetails) => {
              setCard(cardDetails);
              setCard((card) => ({ ...card, currency: "usd" }));
            }}
          />
          <TouchableOpacity
            onPress={() => uploadCard()}
          >
            <Text>Upload Card</Text>
          </TouchableOpacity>
        </SafeAreaView>
      </StripeProvider>
    );

Returned is the following (test-mode) token:

Object {
  "bankAccount": null,
  "card": Object {
    "address": Object {
      "city": null,
      "country": null,
      "line1": null,
      "line2": null,
      "postalCode": null,
      "state": null,
    },
    "brand": "Visa",
    "country": "US",
    **"currency": null,**
    "expMonth": 12,
    "expYear": 2034,
    "funding": "Debit",
    "last4": "5556",
  },
  "created": "1651357079000",
  "id": "...",
  "livemode": false,
  "type": "Card",
}

How should I add the currency tag? Thank you so much.

@charliecruzan-stripe
Copy link
Collaborator Author

is that on ios or android, and which version of stripe-react-native?

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

Successfully merging this pull request may close these issues.

2 participants