Skip to main content

Payment methods

A customer's saved cards and other methods, and which one is the default.

CommandHTTPDescription
payment-methods listGET /v1/payment_methodsList payment methods
payment-methods createPOST /v1/payment_methodsCreate a payment method
payment-methods getGET /v1/payment_methods/{id}Get a payment method
payment-methods updatePATCH /v1/payment_methods/{id}Update the card's expiry
payment-methods deleteDELETE /v1/payment_methods/{id}Remove a payment method
payment-methods set-defaultPOST /v1/payment_methods/{id}/set-defaultSet the method as default

Examples​

--params carries query and path parameters (id, page, filters); --json carries the request body; --fields limits which fields come back — worth using on every list/get to save context. See Global flags for the full reference.

# List payment methods
kobana billing payment-methods list \
--fields "id,public_id,external_id,billing_account_id,credit_card_id"

# Get a payment method
kobana billing payment-methods get --params '{"id": "PAYMENT_METHOD_ID"}'

# Create a payment method
kobana billing payment-methods create \
--json '{"billingAccountId": "BILLINGACCOUNTID", "type": "card"}'

# Update the card's expiry
kobana billing payment-methods update \
--params '{"id": "PAYMENT_METHOD_ID"}' \
--json '{"exp_month": 0, "exp_year": 0}'

# Set the method as default
kobana billing payment-methods set-default \
--params '{"id": "PAYMENT_METHOD_ID"}'

# Remove a payment method
kobana billing payment-methods delete \
--params '{"id": "PAYMENT_METHOD_ID"}' \
--dry-run

Next steps​