# 🚧 Payment Methods

Payment Methods are saved card or bank account connections associated to customer.

# Update Payment Method

PUT https://api.tratta.io/api/v1/payment-methods/{payment-method-uuid}

curl https://api.tratta.io/api/v1/payment-methods/{payment-method-uuid} \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d is_primary="true" \
 -X PUT

# Parameters


is_primary required|boolean

Setting payment method as primary sets any other payment method is_primary to false.

# Returns

A json with data property that contains created payment-method object.

{
  "id": "uuid",
  "type": "card",
  "card_token": {
    "card_holder": "string",
    "card_number": "last4",
    "expiration_month": "12",
    "expiration_year": "2024",
    "card_type": "Visa",
    "card_zip": "10001"
  },
  "billing_address": {
    // Customer address
  },
  "is_primary": false
}

# Attach Customer Address

PUT https://api.tratta.io/api/v1/payment-methods/{payment-method-uuid}/address

curl https://api.tratta.io/api/v1/payment-methods/{payment-method-uuid}/address \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d billing_address_id="1234-1234-1234" \
 -X PUT

# Parameters


billing_address_id required|exists

Existing Customer Address uuid.

# Returns

A json with data property that contains created payment-method object.

{
  "id": "uuid",
  "type": "card",
  "card_token": {
    "card_holder": "string",
    "card_number": "last4",
    "expiration_month": "12",
    "expiration_year": "2024",
    "card_type": "Visa",
    "card_zip": "10001"
  },
  "billing_address": {
    // Customer address
  },
  "is_primary": false
}

# Detach Customer Address

DELETE https://api.tratta.io/api/v1/payment-methods/{payment-method-uuid}/address/{address-uuid}

curl https://api.tratta.io/api/v1/payment-methods/{payment-method-uuid}/address/{address-uuid} \
 -H "Authorization: Bearer eyJ0eXA3asdk..."

# Returns

A json with data property that contains created payment-method object.

{
  "id": "uuid",
  "type": "card",
  "card_token": {
    "card_holder": "string",
    "card_number": "last4",
    "expiration_month": "12",
    "expiration_year": "2024",
    "card_type": "Visa",
    "card_zip": "10001"
  },
  "billing_address": {
    // Customer address
  },
  "is_primary": false
}