Create an Account

Add an account to the profile so that a transaction can be processed against it.

Accepts an AccountRequest object.

Returns an AccountResponse object.

Examples

  • require 'uri'
    require 'net/http'
    
    url = URI("https://api.opentransact.com/v1/accounts")
    
    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",
    		"attributes": {
    			"nickname": "Chase Account",
    			"details": {
    				"type": "bank-account",
    				"account-number": "4111111111111111",
    				"routing-number": "021000021",
    				"account-holder-type": "business",
    				"account-category": "checking"
    			}
    		},
    		"relationships": {
    			"owner": {
    				"data": {
    					"type": "profiles",
    					"id": profile_id
    				}
    			}
    		}
    	}
    }.to_json
    
    response = http.request(request)
    puts response.read_body
    
  • curl --request POST \
      --url https://api.opentransact.com/v1/accounts \
      --header 'authorization: Bearer $API_KEY' \
      --header 'content-type: application/vnd.api+json' \
      --data '{
    	"data": {
    		"type": "accounts",
    		"attributes": {
    			"nickname": "Chase Account",
    			"details": {
    				"type": "bank-account",
    				"account-number": "4111111111111111",
    				"routing-number": "021000021",
    				"account-holder-type": "business",
    				"account-category": "checking"
    			}
    		},
    		"relationships": {
    			"owner": {
    				"data": {
    					"type": "profiles",
    					"id": "$PROFILE_ID"
    				}
    			}
    		}
    	}
    }'