Add Contact to Wallet
Add a personal contact to a company wallet or client wallet.
Note
For best practices, include the
first_name
,last_name
,date_of_birth
,country
,address.name
andaddress.line_1
fields. These fields are required for other operations.You can only add a personal contact to a company wallet or a client wallet.
wallet
ID of the Rapyd Wallet that this contact is associated with. String starting with ewallet_.
Code Samples
.NET
using System; using System.Text.Json; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string wallet = "ewallet_053d64c44834e1d3057ecb68a34c6b6c"; var address = new { name = "Jane Doe", line_1 = "123 Lake Forest Drive", line_2 = "", line_3 = "", city = "Anytown", state = "NY", country = "US", zip = "12345", phone_number = "+14155551234", metadata = new { }, canton = "", district = "" }; var metadata = new { merchant_defined = true }; var requestObj = new { phone_number = "+14155551233", email = "jane200@rapyd.net", first_name = "Jane", last_name = "Doe", mothers_name = "Jane Smith", gender = "female", marital_status = "single", house_type = "lease", address, identification_type = "PA", identification_number = "1233242424", date_of_birth = "11/22/2000", country = "US", nationality = "FR", metadata, }; string request = JsonSerializer.Serialize(requestObj); string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/ewallets/{wallet}/contacts", 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 = { phone_number: '+14155551233', email: 'jane200@rapyd.net', first_name: 'Jane', last_name: 'Doe', mothers_name: 'Jane Smith', gender: 'female', marital_status: 'single', house_type: 'lease', address: { name: 'Jane Doe', line_1: '123 Lake Forest Drive', line_2: '', line_3: '', city: 'Anytown', state: 'NY', country: 'US', zip: '12345', phone_number: '+14155551234', metadata: { }, canton: '', district: '' }, identification_type: 'PA', identification_number: '1233242424', date_of_birth: '11/22/2000', country: 'US', nationality: 'FR', metadata: { merchant_defined: true } }; const result = await makeRequest( 'POST', '/v1/ewallets/ewallet_053d64c44834e1d3057ecb68a34c6b6c/contacts', 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 = [ 'phone_number' => '+14155551233', 'email' => 'jane200@rapyd.net', 'first_name' => 'Jane', 'last_name' => 'Doe', 'mothers_name' => 'Jane Smith', 'gender' => 'female', 'marital_status' => 'single', 'house_type' => 'lease', 'address' => [ 'name' => 'Jane Doe', 'line_1' => '123 Lake Forest Drive', 'line_2' => '', 'line_3' => '', 'city' => 'Anytown', 'state' => 'NY', 'country' => 'US', 'zip' => '12345', 'phone_number' => '+14155551234', 'metadata' => [], 'canton' => '', 'district' => '', ], 'identification_type' => 'PA', 'identification_number' => '1233242424', 'date_of_birth' => '11/22/2000', 'country' => 'US', 'nationality' => 'FR', 'metadata' => [ 'merchant_defined' => true ], ]; try { $object = make_request('post', '/v1/ewallets/ewallet_053d64c44834e1d3057ecb68a34c6b6c/contacts', $body); var_dump($object); } catch(Exception $e) { echo "Error: $e"; } ?>
Python
from pprint import pprint from utilities import make_request wallet = 'ewallet_053d64c44834e1d3057ecb68a34c6b6c' contact_details = { "phone_number": "+14155551233", "email": "jane200@rapyd.net", "first_name": "Jane", "last_name": "Doe", "mothers_name": "Jane Smith", "gender": "female", "marital_status": "single", "house_type": "lease", "address": { "name": "Jane Doe", "line_1": "123 Lake Forest Drive", "line_2": "", "line_3": "", "city": "Anytown", "state": "NY", "country": "US", "zip": "12345", "phone_number": "+14155551234", "metadata": {}, "canton": "", "district": "" }, "identification_type": "PA", "identification_number": "1233242424", "date_of_birth": "11/22/2000", "country": "US", "nationality": "FR", "metadata": { "merchant_defined": True } } results = make_request(method='post', path=f'/v1/ewallets/{wallet}/contacts', body=contact_details) pprint(results)
/v1/ewallets/:wallet/contacts
Add Contact to Wallet
curl -X post https://sandboxapi.rapyd.net/v1/ewallets/ewallet_81f73a4ca8fe9dba1c64a5ed411bf322/contacts -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 '{ "phone_number": "+5511978789562", "contact_reference_id": "johndoe", "email": "johndoe@rapyd.net", "first_name": "John", "last_name": "Doe", "mothers_name": "Jane Smith", "house_type": "lease", "address": { "name": "John Doe", "line_1": "123 Lake Forest Drive", "line_2": "", "line_3": "", "city": "Anytown", "state": "NY", "country": "BR", "zip": "47834001", "phone_number": "+5511978789562", "metadata": { "merchant_defined": true }, "canton": "", "district": "" }, "identification_type": "ID", "identification_number": "82237738050", "date_of_birth": "11/22/2000", "country": "BR", "nationality": "BR", "metadata": { "merchant_defined": true } } '
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "827ce7b0-a324-4333-a76c-89bc0d11a722" }, "data": { "id": "cont_b6964247ed4099ae4457953f04b606c3", "first_name": "John", "last_name": "Doe", "middle_name": "", "second_last_name": "", "gender": "not_applicable", "marital_status": "not_applicable", "house_type": "lease", "contact_type": "personal", "phone_number": "+5511978789562", "email": "johndoe@rapyd.net", "identification_type": "ID", "identification_number": "82237738050", "issued_card_data": { "preferred_name": "", "transaction_permissions": "", "role_in_company": "" }, "date_of_birth": "2000-11-22", "country": "BR", "nationality": "BR", "address": { "id": "address_5cf20be70412c8ef6651815a3a1bb1f0", "name": "John Doe", "line_1": "123 Lake Forest Drive", "line_2": "", "line_3": "", "city": "Anytown", "state": "NY", "country": "BR", "zip": "47834001", "phone_number": "+5511978789562", "metadata": { "merchant_defined": true }, "canton": "", "district": "", "created_at": 1694074674 }, "ewallet": "ewallet_81f73a4ca8fe9dba1c64a5ed411bf322", "created_at": 1694074674, "metadata": { "merchant_defined": true }, "business_details": null, "compliance_profile": 0, "verification_status": "not verified", "send_notifications": false, "mothers_name": "Jane Smith", "contact_reference_id": "johndoe" } }