Skip to content
This repository was archived by the owner on Mar 27, 2021. It is now read-only.

The procedure for taking data from the form when using individual components for a bank card. #538

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,24 @@ These components display the UI for Elements, and must be used within
- `IbanElement`
- `IdealBankElement`

If you are using `CardNumberElement` and other components instead of `CardElement`, then use the `CardNumberElement` component when fetching data from the form.
```jsx
const stripe = useStripe();
const elements = useElements();

...

const handleSubmit = async (event) => {
event.preventDefault();

const cardData = elements.getElement(CardNumberElement);
const { error, paymentMethod } = await stripe.createPaymentMethod({
type: 'card',
card: cardData
});
}
```

#### Props shape

These components accept all `options` that can be passed into
Expand Down