# Payment methods

Payment methods represent the type of payment sources (e.g., Credit Card, PayPal, Apple Pay, etc.) offered in a [market](https://docs.commercelayer.io/core-api-reference/markets) and/or [store](https://docs.commercelayer.io/core-api-reference/stores). They can have a price and must be present before placing an [order](https://docs.commercelayer.io/core-api-reference/orders).

A payment method must be associated with a [payment gateway](https://docs.commercelayer.io/core-api-reference/payment_gateways). The payment source type used with a payment method depends on the associated gateway.

{% hint style="info" %}
The available payment method options [when a store is in scope](https://docs.commercelayer.io/core-api-reference/stores#available-payment-methods) are defined by the payment methods enabled for the store only. If the store has no payment method enabled, the associated market's payment methods will be returned as the available payment methods for the store.
{% endhint %}

## Default payment method

A payment method that is not already associated with a market or a store can be set as the [default payment method](https://docs.commercelayer.io/core-api-reference/markets#default-payment-method) for one or more markets. To do that:

* [Create](https://docs.commercelayer.io/core-api-reference/payment_methods/create) a new payment method and keep it as more generic as possible by setting the required parameters only:
  * `name`
  * `currency_code`
  * `price_amount_cents`
  * `payment_source_type`
  * `payment_gateway`
* Now you can set that payment method as the default for one or more markets as long as they are associated with a price list in the same currency.

## Placement options

At the payment method level, you can set an option to configure when the order is placed upon asynchronous authorization:

* **Auto-place** — set the `auto_place` attribute to `true` if you want your orders to be automatically placed as soon as we get a successful webhook from the payment gateway.

{% hint style="warning" %}
At the moment this option is available for [Adyen](https://app.gitbook.com/s/-Lk-ezuDClaMavTqnRi0/placing-orders/payments/adyen), [Axerve](https://app.gitbook.com/s/-Lk-ezuDClaMavTqnRi0/placing-orders/payments/axerve), [Checkout.com](https://app.gitbook.com/s/-Lk-ezuDClaMavTqnRi0/placing-orders/payments/checkout.com), [Satispay](https://docs.commercelayer.io/core-api-reference/satispay_gateways), [Stripe](https://app.gitbook.com/s/-Lk-ezuDClaMavTqnRi0/placing-orders/payments/stripe), and [external payments](https://app.gitbook.com/s/-Lk-ezuDClaMavTqnRi0/placing-orders/payments/external-payments).
{% endhint %}

## Capture options

At the payment method level, you can set a couple of options to configure at which step of the order lifecycle the payment [capture](https://docs.commercelayer.io/core-api-reference/captures) is performed in your market(s):

* **Auto-capture** — set the `auto_capture` attribute to `true` if you want payments to be automatically captured as soon as they are authorized. Add the `auto_capture_max_amount_cents` value if you want the auto-capture option to be enabled only for orders under a certain amount.
* **Delayed capture** — set the `require_capture` attribute to `false` if you want to start fulfilling your orders even if their payment is not captured yet and manually capture them when they’re ready to be shipped.

<details>

<summary>Data model</summary>

Check the related [ER diagram](https://commercelayer.io/docs/data-model/payment-methods) and explore the flowchart that illustrates how the payment method resource relates to the other API entities.

</details>

<details>

<summary>How-to</summary>

Check the related [guide](https://app.gitbook.com/s/-Lk-ezuDClaMavTqnRi0/placing-orders/auto-capture) for any additional info on how to set up auto-capture for your orders.

</details>
