# Checkout

## Get invoice from checkout token

> Retrieves the invoice associated with the checkout token

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Bearer token authentication for checkout endpoints. Pass the token as \"Bearer {token}\" in the Authorization header.","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"CheckoutInvoiceReply":{"description":"Invoice response","properties":{"created_at":{"type":"string"},"currency":{"type":"string"},"customer_id":{"type":"string"},"due_date":{"type":"string"},"id":{"type":"string"},"invoice_number":{"type":"string"},"status":{"type":"string"},"sub_total":{"type":"number"},"total":{"type":"number"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/checkout/v1/invoice":{"get":{"description":"Retrieves the invoice associated with the checkout token","operationId":"checkoutGetInvoice","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutInvoiceReply"}}}},"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":"Get invoice from checkout token","tags":["Checkout"]}}}}
```

## Get invoice PDF link from checkout token

> Retrieves the PDF download link for the invoice associated with the checkout token

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Bearer token authentication for checkout endpoints. Pass the token as \"Bearer {token}\" in the Authorization header.","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"CheckoutGetPdfLinkReply":{"description":"PDF link response","properties":{"url":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/checkout/v1/invoice/pdf-link":{"get":{"description":"Retrieves the PDF download link for the invoice associated with the checkout token","operationId":"checkoutGetInvoicePdfLink","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutGetPdfLinkReply"}}}},"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":"Get invoice PDF link from checkout token","tags":["Checkout"]}}}}
```

## Get payment methods from checkout token

> Retrieves all payment methods for the customer associated with the checkout token

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Bearer token authentication for checkout endpoints. Pass the token as \"Bearer {token}\" in the Authorization header.","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"CheckoutGetPaymentMethodsReply":{"description":"List of payment methods response","properties":{"data":{"items":{"$ref":"#/components/schemas/CheckoutPaymentMethod"},"type":"array"}},"type":"object"},"CheckoutPaymentMethod":{"description":"Payment method information","properties":{"brand":{"type":"string"},"created_at":{"type":"string"},"default":{"type":"boolean"},"exp_month":{"type":"string"},"exp_year":{"type":"string"},"id":{"type":"string"},"last4":{"type":"string"},"type":{"$ref":"#/components/schemas/checkout_api.MethodType"}},"type":"object"},"checkout_api.MethodType":{"enum":["card","ach"],"type":"string"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/checkout/v1/payment-methods":{"get":{"description":"Retrieves all payment methods for the customer associated with the checkout token","operationId":"checkoutListPaymentMethods","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutGetPaymentMethodsReply"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Get payment methods from checkout token","tags":["Checkout"]}}}}
```

## Register CVV for a card payment from checkout token

> Register an encrypted CVV token for a specific card. Uses customer\_id and invoice\_id from checkout token.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Bearer token authentication for checkout endpoints. Pass the token as \"Bearer {token}\" in the Authorization header.","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"CheckoutCreateCardCvvResponse":{"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"},"CheckoutCreateCardCvvInput":{"description":"CVV registration information","properties":{"cvv_secret":{"type":"string"},"provider":{"allOf":[{"$ref":"#/components/schemas/checkout_api.CardProvider"}],"enum":["evervault"]}},"type":"object"},"checkout_api.CardProvider":{"enum":["evervault"],"type":"string"}}},"paths":{"/checkout/v1/payment-methods/{card_id}/cvv":{"post":{"description":"Register an encrypted CVV token for a specific card. Uses customer_id and invoice_id from checkout token.","operationId":"checkoutVerifyCvv","parameters":[{"schema":{"type":"string"},"description":"Card ID","in":"path","name":"card_id","required":true}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutCreateCardCvvResponse"}}}},"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 from checkout token","tags":["Checkout"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutCreateCardCvvInput"}}},"description":"CVV registration information","required":true}}}}}
```

## Calculate card payment fees

> Calculate payment fees for a specific card payment method using checkout token

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Bearer token authentication for checkout endpoints. Pass the token as \"Bearer {token}\" in the Authorization header.","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"CheckoutGetCardPaymentFeesResponse":{"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"},"CheckoutGetCardPaymentFeesRequest":{"description":"Request body for calculating card payment fees","properties":{"amount":{"type":"string"},"currency":{"enum":["USD","CAD"],"type":"string"}},"type":"object"}}},"paths":{"/checkout/v1/payment-methods/{card_id}/fees":{"post":{"description":"Calculate payment fees for a specific card payment method using checkout token","operationId":"checkoutGetCardFees","parameters":[{"schema":{"type":"string"},"description":"Card ID","in":"path","name":"card_id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutGetCardPaymentFeesResponse"}}}},"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":["Checkout"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutGetCardPaymentFeesRequest"}}},"description":"Fee calculation request","required":true}}}}}
```

## Create a bank account payment method from checkout token

> Creates a new bank account payment method for the customer associated with the checkout token. 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":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Bearer token authentication for checkout endpoints. Pass the token as \"Bearer {token}\" in the Authorization header.","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"CheckoutCreateBankAccountResponse":{"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"},"CheckoutCreateBankAccountInput":{"description":"Create bank account payment method request body. 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/CheckoutCAAccountData"},"custom_name":{"type":"string"},"institution_name":{"type":"string"},"receiver_name":{"type":"string"},"subtype":{"allOf":[{"$ref":"#/components/schemas/checkout_api.AccountSubtype"}],"enum":["checkings","savings"]},"type":{"allOf":[{"$ref":"#/components/schemas/checkout_api.AccountType"}],"enum":["depository"]},"us_account_data":{"$ref":"#/components/schemas/CheckoutUSAccountData"}},"type":"object"},"CheckoutCAAccountData":{"description":"Canadian bank account data","properties":{"account_number":{"type":"string"},"institution_code":{"type":"string"},"transit_number":{"type":"string"}},"type":"object"},"checkout_api.AccountSubtype":{"enum":["checkings","savings"],"type":"string"},"checkout_api.AccountType":{"enum":["depository"],"type":"string"},"CheckoutUSAccountData":{"description":"US bank account data","properties":{"account_number":{"type":"string"},"routing_number":{"type":"string"}},"type":"object"}}},"paths":{"/checkout/v1/payment-methods/bank":{"post":{"description":"Creates a new bank account payment method for the customer associated with the checkout token. Only one of USAccountData or CAAccountData must be sent, matching AccountDataType.","operationId":"checkoutCreateBank","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutCreateBankAccountResponse"}}}},"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 bank account payment method from checkout token","tags":["Checkout"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutCreateBankAccountInput"}}},"description":"Bank account information","required":true}}}}}
```

## Create a card payment method from checkout token

> Creates a new card payment method for the customer associated with the checkout token

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Bearer token authentication for checkout endpoints. Pass the token as \"Bearer {token}\" in the Authorization header.","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"CheckoutCreateCardResponse":{"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"},"CheckoutCreateCardInput":{"description":"Create card payment method request body","properties":{"address":{"$ref":"#/components/schemas/CheckoutAddressInput"},"card_provider_token":{"type":"string"},"custom_name":{"type":"string"},"provider":{"allOf":[{"$ref":"#/components/schemas/checkout_api.CardProvider"}],"enum":["evervault"]}},"type":"object"},"CheckoutAddressInput":{"description":"Billing 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"},"checkout_api.CardProvider":{"enum":["evervault"],"type":"string"}}},"paths":{"/checkout/v1/payment-methods/card":{"post":{"description":"Creates a new card payment method for the customer associated with the checkout token","operationId":"checkoutCreateCard","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutCreateCardResponse"}}}},"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 card payment method from checkout token","tags":["Checkout"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutCreateCardInput"}}},"description":"Card information","required":true}}}}}
```

## Create a payment from checkout token

> Creates a payment for the invoice associated with the checkout token. Customer ID and invoice ID are extracted from the token.

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"description":"Bearer token authentication for checkout endpoints. Pass the token as \"Bearer {token}\" in the Authorization header.","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"CheckoutCreatePaymentResponse":{"description":"Create payment response","properties":{"message":{"type":"string"},"status":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"CheckoutCreatePaymentInput":{"description":"Create payment request body","properties":{"amount":{"type":"string"},"idempotency_key":{"type":"string"},"payment_date":{"type":"string"},"payment_method":{"enum":["card","standard_ach"],"type":"string"},"payment_method_id":{"type":"string"}},"type":"object"}}},"paths":{"/checkout/v1/payments":{"post":{"description":"Creates a payment for the invoice associated with the checkout token. Customer ID and invoice ID are extracted from the token.","operationId":"checkoutCreatePayment","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutCreatePaymentResponse"}}}},"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 payment from checkout token","tags":["Checkout"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutCreatePaymentInput"}}},"description":"Payment information","required":true}}}}}
```


---

# Agent Instructions: 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:

```
GET https://docs.alternativepayments.io/api-reference/checkout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
