> For the complete documentation index, see [llms.txt](https://docs.alternativepayments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alternativepayments.io/api-reference/paymentmethods.md).

# PaymentMethods

## Register CVV for a card payment

> Register an encrypted CVV token for a specific card and invoice

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["payments:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"CreateCardCvvResponse":{"description":"Create card CVV response","properties":{"success":{"type":"boolean"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"CreateCardCvvInput":{"description":"CVV registration information","properties":{"cvv_secret":{"type":"string"},"product_id":{"type":"string"},"product_type":{"enum":["invoice"],"type":"string"},"provider":{"enum":["evervault"],"type":"string"}},"type":"object"}}},"paths":{"/customers/{id}/payment-methods/{card_id}/cvv":{"post":{"description":"Register an encrypted CVV token for a specific card and invoice","operationId":"verifyCardCvv","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true},{"schema":{"type":"string"},"description":"Card ID","in":"path","name":"card_id","required":true}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCardCvvResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Register CVV for a card payment","tags":["PaymentMethods"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCardCvvInput"}}},"description":"CVV registration information","required":true}}}}}
```

## Calculate card payment fees

> Calculate payment fees for a specific card payment method

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:read"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"GetCardPaymentFeesResponse":{"description":"Response containing calculated payment fees for card payments","properties":{"fee_percentage_for_customer":{"type":"string"},"fee_percentage_for_partner":{"type":"string"},"fixed_fee_amount_customer":{"type":"string"},"fixed_fee_amount_partner":{"type":"string"},"relative_fee_amount_customer":{"type":"string"},"relative_fee_amount_partner":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"GetCardPaymentFeesRequest":{"description":"Request body for calculating card payment fees","properties":{"amount":{"type":"string"},"currency":{"enum":["USD","CAD"],"type":"string"}},"type":"object"}}},"paths":{"/customers/{id}/payment-methods/{card_id}/fees":{"post":{"description":"Calculate payment fees for a specific card payment method","operationId":"getCardPaymentFees","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true},{"schema":{"type":"string"},"description":"Card ID","in":"path","name":"card_id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetCardPaymentFeesResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Calculate card payment fees","tags":["PaymentMethods"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetCardPaymentFeesRequest"}}},"description":"Fee calculation request","required":true}}}}}
```

## Delete a customer's payment method

> Delete this payment method

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["payments:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"DeletePaymentMethodResponse":{"description":"Delete a payment method","properties":{"response":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/customers/{id}/payment-methods/{method_id}":{"delete":{"description":"Delete this payment method","operationId":"deletePaymentMethod","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true},{"schema":{"type":"string"},"description":"Payment Method ID","in":"path","name":"method_id","required":true}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletePaymentMethodResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Delete a customer's payment method","tags":["PaymentMethods"]}}}}
```

## Change a customer's default payment method

> Change the customer's default payment method to this one

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["payments:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"ChangeDefaultResponse":{"description":"Change default method response","properties":{"response":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/customers/{id}/payment-methods/{method_id}/default":{"patch":{"description":"Change the customer's default payment method to this one","operationId":"setDefaultPaymentMethod","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true},{"schema":{"type":"string"},"description":"Payment Method ID","in":"path","name":"method_id","required":true}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeDefaultResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Change a customer's default payment method","tags":["PaymentMethods"]}}}}
```

## Create a customer bank account

> Create a new bank account with the provided information. Only one of USAccountData or CAAccountData must be sent, matching AccountDataType.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["payments:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"CreateBankAccountResponse":{"description":"Create bank account response","properties":{"id":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"CreateBankAccountInput":{"description":"Bank account information. Only one of USAccountData or CAAccountData must be sent, matching AccountDataType.","properties":{"account_data_type":{"enum":["us","ca"],"type":"string"},"ca_account_data":{"$ref":"#/components/schemas/payment_methods_api.CAAccountData"},"custom_name":{"type":"string"},"institution_name":{"type":"string"},"receiver_name":{"type":"string"},"subtype":{"enum":["checkings","savings"],"type":"string"},"type":{"enum":["depository"],"type":"string"},"us_account_data":{"$ref":"#/components/schemas/payment_methods_api.USAccountData"}},"type":"object"},"payment_methods_api.CAAccountData":{"properties":{"account_number":{"type":"string"},"institution_code":{"type":"string"},"transit_number":{"type":"string"}},"type":"object"},"payment_methods_api.USAccountData":{"properties":{"account_number":{"type":"string"},"routing_number":{"type":"string"}},"type":"object"}}},"paths":{"/customers/{id}/payment-methods/bank":{"post":{"description":"Create a new bank account with the provided information. Only one of USAccountData or CAAccountData must be sent, matching AccountDataType.","operationId":"createBankPaymentMethod","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBankAccountResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Create a customer bank account","tags":["PaymentMethods"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBankAccountInput"}}},"description":"BankAccount information","required":true}}}}}
```

## Create a customer card

> Create a new card with the provided tokenized information

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["payments:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"CreateCardResponse":{"description":"Create card response","properties":{"id":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"CreateCardInput":{"description":"Tokenized card information","properties":{"address":{"$ref":"#/components/schemas/AddressInput"},"card_provider_token":{"type":"string"},"custom_name":{"type":"string"},"provider":{"enum":["evervault"],"type":"string"}},"type":"object"},"AddressInput":{"description":"Address information","properties":{"city":{"type":"string"},"country":{"type":"string"},"country_code":{"type":"string"},"postal_code":{"type":"string"},"state":{"type":"string"},"state_code":{"type":"string"},"street_address":{"type":"string"},"subpremise":{"type":"string"}},"type":"object"}}},"paths":{"/customers/{id}/payment-methods/card":{"post":{"description":"Create a new card with the provided tokenized information","operationId":"createCardPaymentMethod","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCardResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Create a customer card","tags":["PaymentMethods"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCardInput"}}},"description":"Card information","required":true}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.alternativepayments.io/api-reference/paymentmethods.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
