Create a Phone Number

Phone Numbers can be attached to profiles. If no phone numbers are currently attached to an owner, the first phone number will become the default. Some payment gateways may require phone numbers be submitted with the transaction details.

Accepts a PhoneNumberRequest object. Returnas a PhoneNumberResponse object.

Example (Ruby)

require 'uri'
require 'net/http'

url = URI("https://api.opentransact.com/v1/phone-numbers")

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": "phone-numbers",
		"attributes": {
			"number": "+12125551212"
		},
		"relationships": {
			"owner": {
				"data": {
					"type": "profiles",
					"id": $PROFILE_ID
				}
			}
		}
	}
}.to_json

response = http.request(request)
puts response.read_body

Example (cURL)

curl --request POST \
  --url https://api.opentransact.com/v1/phone-numbers \
  --header 'authorization: Bearer $API_KEY' \
  --header 'content-type: application/vnd.api+json' \
  --data '{
	"data": {
		"type": "phone-numbers",
		"attributes": {
			"number": "+12125551212"
		},
		"relationships": {
			"owner": {
				"data": {
					"type": "profiles",
					"id": $PROFILE_ID
				}
			}
		}
	}
}'