diff --git a/openapi.yaml b/openapi.yaml index 79e24634b..406367e42 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -551,15 +551,9 @@ paths: - Account summary: Credit Card Add/Edit description: | - Adds/edit credit card information to your Account. + **DEPRECATED**. Please use Payment Method Add ([POST /account/payment-methods](/docs/api/account/#payment-method-add)). - Only one credit card can be associated with your Account, so using this - endpoint will overwrite your currently active card information with the - new credit card. - - To use this endpoint, you must have a valid `zip` entered for your Account. - Use the Account Update ([PUT /account](/docs/api/account/#account-update)) - endpoint to enter a new zip code. + Adds a credit card Payment Method to your account and sets it as the default method. operationId: createCreditCard x-linode-cli-action: update-card security: @@ -572,15 +566,7 @@ paths: content: application/json: schema: - allOf: - - $ref: '#/components/schemas/CreditCard' - - type: object - properties: - cvv: - type: string - description: > - The Card Verification Value on the back of the card. - example: '123' + $ref: '#/components/schemas/CreditCard' responses: '200': description: Credit Card updated. @@ -1676,46 +1662,7 @@ paths: data: type: array items: - type: object - description: Payment Method object response. - properties: - type: - type: string - description: The type of Payment Method. - example: 'credit_card' - x-linode-cli-display: 1 - is_default: - type: boolean - description: | - Whether this Payment Method is the default method for automatically processing service charges. - example: true - x-linode-cli-display: 2 - created: - type: string - readOnly: true - format: date-time - description: When the Payment Method was added to the Account. - example: '2018-01-15T00:01:01' - data: - type: object - description: Credit card information. - properties: - card_type: - type: string - description: The type of credit card. - example: "" - x-linode-cli-display: 8 - last_four: - type: string - description: The last four digits of the credit card number. - example: "1234" - x-linode-cli-display: 9 - expiry: - type: string - format: MM/YYYY - description: The expiration month and year of the credit card. - example: 06/2022 - x-linode-cli-display: 10 + $ref: '#/components/schemas/PaymentMethod' page: $ref: '#/components/schemas/PaginationEnvelope/properties/page' pages: @@ -1732,6 +1679,82 @@ paths: - lang: CLI source: > linode-cli account payment-methods-list + post: + servers: + - url: https://api.linode.com/v4 + x-linode-grant: read_write + tags: + - Account + summary: Payment Method Add + description: | + Adds a Payment Method to your Account with the option to set it as the default method. + + Prior to adding a Payment Method, ensure that your billing address information is up-to-date + with a valid `zip` by using the Account Update ([PUT /account](/docs/api/account/#account-update)) endpoint. + operationId: createPaymentMethod + x-linode-cli-action: payment-method-add + x-linode-cli-skip: true + security: + - personalAccessToken: [] + - oauth: + - account:read_write + requestBody: + description: The details of the Payment Method to add. + required: true + content: + application/json: + schema: + type: object + description: Payment Method Request Object. + required: + - type + - data + - is_default + - card_number + - expiry_month + - expiry_year + - cvv + properties: + type: + $ref: '#/components/schemas/PaymentMethod/properties/type' + is_default: + $ref: '#/components/schemas/PaymentMethod/properties/is_default' + data: + type: object + properties: + card_number: + $ref: '#/components/schemas/CreditCard/properties/card_number' + expiry_month: + $ref: '#/components/schemas/CreditCard/properties/expiry_month' + expiry_year: + $ref: '#/components/schemas/CreditCard/properties/expiry_year' + cvv: + $ref: '#/components/schemas/CreditCard/properties/cvv' + responses: + '200': + description: Payment Method added. + content: + application/json: + schema: + type: object + default: + $ref: '#/components/responses/ErrorResponse' + x-code-samples: + - lang: Shell + source: > + curl -H "Content-Type: application/json" \ + -H "Authorization: Bearer $TOKEN" \ + -X POST -d '{ + "type": "credit_card", + "is_default": true, + "data": { + "card_number": "4111111111111111", + "expiry_month": 11, + "expiry_year": 2020, + "cvv": "111" + } + }' \ + https://api.linode.com/v4/account/payment-method /account/payments: x-linode-cli-command: account get: @@ -15991,11 +16014,14 @@ components: card_number: type: string description: Your credit card number. No spaces or dashes allowed. - minLength: 13 - maxLength: 23 + minLength: 14 + maxLength: 24 + format: digits example: 4111111111111111 expiry_month: type: integer + minimum: 1 + maximum: 12 description: > A value from 1-12 representing the expiration month of your credit card. @@ -16006,7 +16032,9 @@ components: example: 12 expiry_year: type: integer - description: > + minLength: 4 + maxLength: 4 + description: | A four-digit integer representing the expiration year of your credit card. @@ -16014,6 +16042,14 @@ components: must result in a month/year combination of the current month or in the future. An expiration date set in the past is invalid. example: 2020 + cvv: + type: string + minLength: 3 + maxLength: 4 + format: digits + description: > + CVV (Card Verification Value) of the credit card, typically found on the back of the card. + example: '123' Device: type: object description: > @@ -20641,6 +20677,52 @@ components: description: The amount, in US dollars, of the Payment. example: '120.50' x-linode-cli-display: 3 + PaymentMethod: + type: object + description: Payment Method Response Object. + properties: + type: + type: string + enum: + - credit_card + description: The type of Payment Method. + example: 'credit_card' + x-linode-cli-display: 1 + is_default: + type: boolean + description: | + Whether this Payment Method is the default method for automatically processing service charges. + example: true + x-linode-cli-display: 2 + created: + type: string + readOnly: true + format: date-time + description: When the Payment Method was added to the Account. + example: '2018-01-15T00:01:01' + data: + type: object + description: Credit card information. + properties: + card_type: + type: string + readOnly: true + description: The type of credit card. + example: "" + x-linode-cli-display: 8 + last_four: + type: string + readOnly: true + description: The last four digits of the credit card number. + example: "1234" + x-linode-cli-display: 9 + expiry: + type: string + readOnly: true + format: MM/YYYY + description: The expiration month and year of the credit card. + example: 06/2022 + x-linode-cli-display: 10 PaymentRequest: type: object required: @@ -20651,7 +20733,7 @@ components: type: string description: > CVV (Card Verification Value) of the credit card to be used for - the Payment. + the Payment. Required if paying by credit card. example: '123' usd: type: string