Update an Account

All accounts can update their nickname or metadata. CreditCard accounts can have their details updated.

Accepts an UpdateAccountRequest object.

Returns an AccountResponse object

require 'uri'
require 'net/http'

url = URI("https://api.opentransact.com/v1/accounts/#{account_id}")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["authorization"] = "Bearer #{API_KEY}"
request["content-type"] = 'application/vnd.api+json'
request.body = {
	"data": {
		"type": "accounts",
		"id": account_id,
		"attributes": {
			"nickname": "VISA Card Updated",
			"details": {
				"type": "credit-cards",
				"cardholder-name": "John Wayne",
				"cvv": "997"
			}
		}
	}
}
}.to_json

response = http.request(request)
puts response.read_body
curl --request PUT \
  --url https://api.opentransact.com/v1/accounts/$ACCOUNT_ID \
  --header 'authorization: Bearer $API_KEY' \
  --header 'content-type: application/vnd.api+json' \
  --data '{
	"data": {
		"type": "accounts",
		"id": $ACCOUNT_ID,
		"attributes": {
			"nickname": "VISA Card Updated",
			"details": {
				"type": "credit-cards",
				"cardholder-name": "John Wayne",
				"cvv": "997"
			}
		}
	}
}'