Skip to main content

Documentation

Create Address

Create an address.

Code Samples
    • .Net Core

      • using System;
        using System.Text.Json;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        var requestObj = new
                        {
                            name = "John Doe",
                            line_1 = "123 State Street",
                            line_2 = "Apt. 34",
                            line_3 = "",
                            city = "Anytown",
                            district = "",
                            canton = "",
                            state = "NY",
                            country = "US",
                            zip = "12345",
                            phone_number = "12125559999",
                            metadata = new { merchant_defined = true }
                        };
                        string request = JsonSerializer.Serialize(requestObj);
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("POST", "/v1/addresses", request);
        
                        Console.WriteLine(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
        
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        
        async function main() {
          try {
            const body = {
              name: 'John Doe',
              line_1: '123 State Street',
              line_2: 'Apt. 34',
              line_3: '',
              city: 'Anytown',
              district: '',
              canton: '',
              state: 'NY',
              country: 'US',
              zip: '12345',
              phone_number: '12125559999',
              metadata: {
                merchant_defined: true
              }
            };
            const result = await makeRequest('POST', '/v1/addresses', body);
        
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        
        $body = [
            "name" => "John Doe",
            "line_1" => "123 State Street",
            "line_2" => "Apt. 34",
            "line_3" => "",
            "city" => "Anytown",
            "district" => "",
            "canton" => "",
            "state" => "NY",
            "country" => "US",
            "zip" => "12345",
            "phone_number" => "12125559999",
            "metadata" => array(
                "merchant_defined" => true
            )
        ];
        
        try {
            $object = make_request('post', '/v1/addresses', $body);
            var_dump($object);
        } catch(Exception $e) {
            echo "Error =>$e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        address = {
            "name": "John Doe",
            "line_1": "123 State Street",
            "line_2": "Apt. 34",
            "line_3": "",
            "city": "Anytown",
            "district": "",
            "canton": "",
            "state": "NY",
            "country": "US",
            "zip": "12345",
            "phone_number": "12125559999",
            "metadata": {
                "merchant_defined": True
            }
        }
        result = make_request(method='post', path='/v1/addresses', body=address)
        pprint(result)
  • /v1/addresses

  • Create Address

  • curl -X post
    https://sandboxapi.rapyd.net/v1/addresses
    -H 'access_key: your-access-key-here'
    -H 'Content-Type: application/json'
    -H 'idempotency: your-idempotency-parameter-here'
    -H 'salt: your-random-string-here'
    -H 'signature: your-calculated-signature-here'
    -H 'timestamp: your-unix-timestamp-here'
    -d '{
        "name": "John Doe",
        "line_1": "123 State Street",
        "line_2": "Apt. 34",
        "line_3": "",
        "city": "Anytown",
        "district": "",
        "canton": "",
        "state": "NY",
        "country": "US",
        "zip": "12345",
        "phone_number": "12125559999",
        "metadata": {
        	"merchant_defined": true
        }
    }
      
    '
    
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "74832dc9-d94d-46cf-8a55-bdad72ceb24e"
        },
        "data": {
            "id": "address_71f1048a5837feb31b594f9d3d9b6623",
            "name": "John Doe",
            "line_1": "123 State Street",
            "line_2": "Apt. 34",
            "line_3": "",
            "city": "Anytown",
            "state": "NY",
            "country": "US",
            "zip": "12345",
            "phone_number": "12125559999",
            "metadata": {
                "merchant_defined": true
            },
            "canton": "",
            "district": "",
            "created_at": 1551689479
        }
    }