# Payments

Source: https://developers.swell.is/guides/core-concepts/payments

Facilitating transactions and capturing payments are as flexible as any other aspect of the platform. Take control of your checkout process and drive purchases by offering customers a variety of payment options. Whether you are seeking to build out your own checkout flow or use Swell's hosted checkout, we support a diverse mix of payment gateways, capture flows, and the ability to define your own custom payment methods.

### Payments and the account model

While Swell supports guest checkout by default with the `guest=true` flag, customers who have created accounts within your store will be able to access their saved payment methods, credit balances, and correct pricing for their account group. Once signed in, the session and cart will be tied to the user's account id—allowing them to apply any gift card balance they may have, use a saved payment method, or add a new one.

Charges can also be initiated directly through the API or dashboard. This provides a way to facilitate a purchase on behalf of customers without requiring them to go through a checkout process.

[See the account model →](https://developers.swell.is/backend-api/accounts/the-account-model)

#### Customer account credits

Along with saving payment methods like a credit card or PayPal account, Swell also provides the means for adding store credits to an account. Credits can be added in the dashboard, via gift cards, or directly to the `balance` field on the `account`. For example, you could implement a rewards program where purchases generate account credits at a nominal rate.

#### Gift cards

Swell supports applying gift cards to a user's account `balance` for use during a transaction. Gift cards operate in two ways: they can either be applied to an account (on `account.balance`) or redeemed during checkout towards the order total.

### Checkout and payment capture

With your store, you have multiple options for checkout implementation, payment gateways, and support for multiple currencies.

#### Hosted checkout

Included with all Swell stores, our hosted checkout works for both subscriptions and one-time purchases. It supports multiple payment methods, including credit card, PayPal, Apple Pay, Amazon Pay, Google Pay, and Klarna. You can use any of our supported payment gateways to process transactions. This solution requires minimal configuration and allows you to start selling immediately.

#### Custom checkout flows

Swell also supports the implementation of custom checkout flows with Swell.js—which can be used to render stripe elements, PayPal and other checkout buttons, and custom components. Custom checkouts can also use Swell to tokenize credit card information for saving customers' payment methods. Utilizing the [Backend API](https://developers.swell.is/backend-api/introduction) in conjunction with [Swell.js](https://developers.swell.is/frontend-api/introduction) opens more flexibility for implementing custom checkout flow solutions such as splitting payments into vendor payouts or providing unique offers based on customer groups.

#### Swell Vault and tokenization

Swell provides a vault for storing encrypted credit card information. This allows customers to use any of their saved cards during checkout and enables recurring billing with any payment gateway that supports vaulted cards. When using Swell's hosted checkout, cards are tokenized and stored in our vault. Tokens are stored on customer accounts as `billing.card.token`. Once stored, you can switch payment gateways without customers needing to re-enter their payment information.

#### Payment capture and statuses

All payment flows run through Swell—this refers to payments and refunds for both subscriptions and one-time purchases. Depending on the gateway and method, payments will either go through an authorization stage before being captured or be captured immediately.

There are four payment `status` values within Swell:

- `pending` denotes a payment that is awaiting manual processing. For example, the customer is paying via bank transfer, and an admin will add the payment details to the order in the Swell dashboard.
- `error` will be the status when there is an issue with authorization or capture. The error details returned by the payment gateway will be present in the `error` field on the payment record.
- `authorized` signifies that a payment has been authorized but not yet captured.
- `success` marks a payment that has been successfully captured.

#### Multi-currency transactions

Support for multiple currencies is managed from the dashboard under **Payments** settings. Your store's default currency is denoted as the `base` currency. When adding multiple currencies, there are two modes that determine how they are displayed and used in checkouts:

- `display` currencies use mid-market exchange rates and rounding rules to convert prices from your base currency for displaying on a storefront. The customer will still pay in the base currency, with conversion handled by their banking provider. This mode is useful when you have customers in many countries and want to display approximate prices in their local currency.
- `priced` currencies allow you to set exact prices in each currency which customers will pay during checkout, with no conversion occurring on their side—assuming they are using a payment method holding funds in the same currency. If a price hasn't been set for a product in a particular currency, Swell will convert the price from your base currency using mid-market rates according to the rounding rules you have configured.

> **Tip:** For customers to pay with priced currencies, your payment gateway must support transactions in that currency. Otherwise, they will encounter an error during checkout and be unable to complete their order.

When rendering currencies through Swell.js, display currencies will be shown with `type=display`, while priced currencies will show `type=priced`.
