# Amounts, Currencies and Metadata — Stripe Payments

Source: https://www.skillbyai.com/en/stripe-payments/r-amounts

> Integers in the smallest unit, and linking records.

## Smallest currency units

Stripe amounts are **integers in the smallest currency unit**: 10.00 USD is `1000` cents and 499.00 INR is `49900` paise. **Zero-decimal currencies** such as JPY are sent as whole units (`500` means 500 yen), and a few currencies have special rules, so check the currency docs. Never use floating-point arithmetic for money; store integers alongside the currency code. Currency codes are lowercase three-letter ISO codes such as `usd`, `eur` and `inr`. **Metadata** is a set of key-value strings you attach to most objects (up to 50 keys, with length limits on keys and values) to store your order ID, user ID or cart ID, which makes support and reconciliation much easier. Do not store sensitive data such as card details in metadata.

## Converting prices safely

TypeScript helpers.

```typescript
const ZERO_DECIMAL = new Set(['jpy', 'krw', 'vnd']); // partial list: check the docs

export function toMinorUnits(major: string, currency: string): number {
  // take prices as strings or integers from your catalogue, never floats from user input
  const [whole, frac = ''] = major.split('.');
  if (ZERO_DECIMAL.has(currency)) return parseInt(whole, 10);
  return parseInt(whole, 10) * 100 + parseInt(frac.padEnd(2, '0').slice(0, 2), 10);
}

await stripe.paymentIntents.create({
  amount: toMinorUnits('19.99', 'usd'),   // 1999
  currency: 'usd',
  metadata: { orderId: 'ord_123', userId: 'u_42' },
});

```

## Search by metadata in the Dashboard

Putting your own order ID in metadata lets support staff find a payment instantly, and Stripe's search API can query some objects by metadata.

**Quiz:** How do you represent 25.50 USD in a Stripe amount field?

- [ ] 25.50
- [x] 2550
- [ ] 25
- [ ] 255

*Answer:* 2550. USD amounts are in cents.
