# PostPaymentMethodsPaymentMethod

From **Stripe API**.

`POST /v1/payment_methods/{payment_method}`

<p>Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated.</p>

## Parameters

### `payment_method`

- Location: path
- Required: true
- Type: `string`
- maxLength: `5000`

## Request body

- Required: false
### `application/x-www-form-urlencoded`

- Type: `object`

```json
{"additionalProperties":false,"properties":{"billing_details":{"description":"Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.","properties":{"address":{"anyOf":[{"properties":{"city":{"maxLength":5000,"type":"string"},"country":{"maxLength":5000,"type":"string"},"line1":{"maxLength":5000,"type":"string"},"line2":{"maxLength":5000,"type":"string"},"postal_code":{"maxLength":5000,"type":"string"},"state":{"maxLength":5000,"type":"string"}},"title":"billing_details_address","type":"object"},{"enum":[""],"type":"string"}]},"email":{"anyOf":[{"type":"string"},{"enum":[""],"type":"string"}]},"name":{"maxLength":5000,"type":"string"},"phone":{"maxLength":5000,"type":"string"}},"title":"billing_details_inner_params","type":"object"},"card":{"description":"If this is a `card` PaymentMethod, this hash contains the user's card details.","properties":{"exp_month":{"type":"integer"},"exp_year":{"type":"integer"}},"title":"update_api_param","type":"object"},"expand":{"description":"Specifies which fields in the response should be expanded.","items":{"maxLength":5000,"type":"string"},"type":"array"},"metadata":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"enum":[""],"type":"string"}],"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`."}},"type":"object"}
```

## Security

### `basicAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `basic`
Send credentials in the `Authorization` request header using the `Basic` scheme.

Basic HTTP authentication. Allowed headers-- Authorization: Basic <api_key> | Authorization: Basic <base64 hash of `api_key:`>

### `bearerAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `bearer`
- Bearer format: `auth-scheme`
Send the token in the `Authorization` request header using the `Bearer` scheme.

Bearer HTTP authentication. Allowed headers-- Authorization: Bearer <api_key>

## Responses

### `200`

Successful response.

### `application/json`

- Type: `object`

PaymentMethod objects represent your customer's payment instruments.
They can be used with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or saved to
Customer objects to store instrument details for future payments.

Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).

```json
{"description":"PaymentMethod objects represent your customer's payment instruments.\nThey can be used with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or saved to\nCustomer objects to store instrument details for future payments.\n\nRelated guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).","properties":{"acss_debit":{"$ref":"#/components/schemas/payment_method_acss_debit"},"afterpay_clearpay":{"$ref":"#/components/schemas/payment_method_afterpay_clearpay"},"alipay":{"$ref":"#/components/schemas/payment_flows_private_payment_methods_alipay"},"au_becs_debit":{"$ref":"#/components/schemas/payment_method_au_becs_debit"},"bacs_debit":{"$ref":"#/components/schemas/payment_method_bacs_debit"},"bancontact":{"$ref":"#/components/schemas/payment_method_bancontact"},"billing_details":{"$ref":"#/components/schemas/billing_details"},"boleto":{"$ref":"#/components/schemas/payment_method_boleto"},"card":{"$ref":"#/components/schemas/payment_method_card"},"card_present":{"$ref":"#/components/schemas/payment_method_card_present"},"created":{"description":"Time at which the object was created. Measured in seconds since the Unix epoch.","format":"unix-time","type":"integer"},"customer":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/customer"}],"description":"The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/customer"}]}},"eps":{"$ref":"#/components/schemas/payment_method_eps"},"fpx":{"$ref":"#/components/schemas/payment_method_fpx"},"giropay":{"$ref":"#/components/schemas/payment_method_giropay"},"grabpay":{"$ref":"#/components/schemas/payment_method_grabpay"},"id":{"description":"Unique identifier for the object.","maxLength":5000,"type":"string"},"ideal":{"$ref":"#/components/schemas/payment_method_ideal"},"interac_present":{"$ref":"#/components/schemas/payment_method_interac_present"},"klarna":{"$ref":"#/components/schemas/payment_method_klarna"},"livemode":{"description":"Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.","type":"boolean"},"metadata":{"additionalProperties":{"maxLength":500,"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.","nullable":true,"type":"object"},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["payment_method"],"type":"string"},"oxxo":{"$ref":"#/components/schemas/payment_method_oxxo"},"p24":{"$ref":"#/components/schemas/payment_method_p24"},"sepa_debit":{"$ref":"#/components/schemas/payment_method_sepa_debit"},"sofort":{"$ref":"#/components/schemas/payment_method_sofort"},"type":{"description":"The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.","enum":["acss_debit","afterpay_clearpay","alipay","au_becs_debit","bacs_debit","bancontact","boleto","card","card_present","eps","fpx","giropay","grabpay","ideal","interac_present","klarna","oxxo","p24","sepa_debit","sofort","wechat_pay"],"type":"string","x-stripeBypassValidation":true},"wechat_pay":{"$ref":"#/components/schemas/payment_method_wechat_pay"}},"required":["billing_details","created","id","livemode","object","type"],"title":"PaymentMethod","type":"object","x-expandableFields":["acss_debit","afterpay_clearpay","alipay","au_becs_debit","bacs_debit","bancontact","billing_details","boleto","card","card_present","customer","eps","fpx","giropay","grabpay","ideal","interac_present","klarna","oxxo","p24","sepa_debit","sofort","wechat_pay"],"x-resourceId":"payment_method"}
```

### `default`

Error response.

### `application/json`

- Type: `object`

An error response from the Stripe API

```json
{"description":"An error response from the Stripe API","properties":{"error":{"$ref":"#/components/schemas/api_errors"}},"required":["error"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url https://api.stripe.com/v1/payment_methods/{payment_method} \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '{
  "billing_details": {
    "address": "string",
    "email": "string",
    "name": "string",
    "phone": "string"
  },
  "card": {
    "exp_month": 1,
    "exp_year": 1
  },
  "expand": [
    "string"
  ],
  "metadata": "string"
}'
```
