- Initialization
- Client
- User
- Add User KYC
- Delete Existing Document
- Update User
- Get User Duplicates
- Swap Duplicate User
- Create Node
- Verify ACH-US MFA
- Get All User Nodes
- Get Node
- Get User Transactions
- Trigger Dummy Transactions
- Generate UBO Form
- Get Statements by User
- Get Statements by Node
- Ship Debit Card
- Reset Debit Card
- Verify Micro-Deposits
- Reinitiate Micro-Deposits
- Update Node
- Delete Node
- Generate Apple Pay Token
- Create Transaction
- Create Batch Transaction
- Get Transaction
- Get All Node Transactions
- Delete Transaction
- Comment on Status
- Dispute Card Transaction
- Get All Subnets
- Get Subnet
- Create Subnet
- Update Subnet
- Ship Card Subnet
- Get All Card Subnet Shipments
- Get Card Subnet Shipment
- Delete Card Subnet Shipment
- Register New Fingerprint
- Idempotent Requests
const Synapse = require('synapsenode');
const Client = Synapse.Client;
const client = new Client({
client_id: '<client_id>',
client_secret: '<client_secret>',
fingerprint: '<fingerprint>',
ip_address: '<ip_address>',
// isProduction boolean determines if production (true) or sandbox (false) endpoint is used
isProduction: false
});
To verify an address - supply the payload
client.verifyAddress({
"address_street": "101 2nd st ste 1500",
"address_city": "san francisco",
"address_subdivision": "CA",
"address_country_code": "US",
"address_postal_code": "94105"
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To verify a routing number - supply the payload
client.verifyRoutingNumber({
"routing_num": "084008426",
"type": "ACH-US"
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.createUser({
logins: [
{
email: 'test@synapsefi.com'
}
],
phone_numbers: [
'901.111.1111',
'test@synapsefi.com'
],
legal_names: [
'Test User'
],
documents: [
{
email: 'test@test.com',
phone_number: '901.111.1111',
ip: '::1',
name: 'Test User',
alias: 'Test',
entity_type: 'M',
entity_scope: 'Arts & Entertainment',
day: 2,
month: 5,
year: 1989,
address_street: '944 Market St.',
address_city: 'SF',
address_subdivision: 'CA',
address_postal_code: '94102',
address_country_code: 'US',
virtual_docs: [
{
document_value: '2222',
document_type: 'SSN'
}
],
physical_docs: [
{
document_value: 'data:image/gif;base64,SUQs==',
document_type: 'GOVT_ID'
}
],
social_docs: [
{
document_value: 'https://www.facebook.com/valid',
document_type: 'FACEBOOK'
}
]
}
],
extra: {
supp_id: '122eddfgbeafrfvbbb',
cip_tag: 1,
is_business: false
}
},
'127.0.0.1'
)
.then(user => console.log('USER\n', user))
.catch(error => console.log(error));
If needed, you can pass an options object to set a user specific fingerprint or supply an idempotency key:
client.createUser(
{
"logins": [
{
"email": "test@synapsepay.com"
}
],
"phone_numbers": [
"901.111.1111"
],
"legal_names": [
"Test User"
],
"extra": {
"supp_id": "my_user_id",
"cip_tag":1,
"is_business": false
}
},
'127.0.0.1',
{
fingerprint: 'userSpecificFingerprint',
idempotency_key: 'testIdempotencyKey'
}
)
.then(user => console.log('USER\n', user))
.catch(error => console.log(error));
client.getAllUsers()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
client.getAllUsers({
page: 2,
per_page: 10
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
If using a static fingerprint across platform:
client.getUser('<USER_ID>')
.then(user => console.log('USER\n', user))
.catch(error => console.log(error));
If using user specific fingerprints / ip addresses, use the options object to supply those values:
client.getUser('<USER_ID>', {
fingerprint: 'userSpecificFingerprint',
ip_address: '127.0.0.1'
})
.then(user => console.log('USER\n', user))
.catch(error => console.log(error));
The options object can also be used to pass in the optional user full_dehydrate boolean:
client.getUser('<USER_ID>', {
full_dehydrate: true
})
.then(user => console.log('USER\n', user))
.catch(error => console.log(error));
client.getPlatformTransactions()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
client.getPlatformTransactions({
page: 2,
per_page: 10,
filter: '{"supp_id": "supp_1234"}'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.getPlatformNodes()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
client.getPlatformNodes({
page: 2,
per_page: 10,
filter: '{"id": "12345"}'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.getInstitutions()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.issuePublicKey()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to optionally specify which scopes to issue the public key for:
client.issuePublicKey([
'CLIENT|CONTROLS',
'USER|GET'
])
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.createSubscription('<SUBSCRIPTION_URL>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to specify the scope of the subscription:
client.createSubscription('<SUBSCRIPTION_URL>', [
'USER|PATCH',
'NODE|PATCH',
'TRAN|PATCH'
])
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.getAllSubscriptions()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
client.getAllSubscriptions({
page: 2,
per_page: 1
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.getSubscription('<SUBSCRIPTION_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To update the scope of subscription:
client.updateSubscription('<SUBSCRIPTION_ID>', {
scope: [
'USER|PATCH',
'NODE|PATCH',
'TRAN|PATCH'
]
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To unsubscribe from webhooks:
client.updateSubscription('<SUBSCRIPTION_ID>', {
is_active: false
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.locateAtms({
zip: 94114
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
client.locateAtms({
zip: 94114,
page: 2,
radius: 5,
per_page: 5
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.getCryptoQuotes()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.getCryptoMarketData()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
client.getCryptoMarketData({
currency: 'ETH',
limit: 1
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.getWebhookLogs()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
client.getTradeMarketData({
ticker: 'AAPL'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.addUserKyc({
documents:[{
email: 'test@test.com',
phone_number: '901.111.1111',
ip: '::1',
name: 'Test User',
alias: 'Test',
entity_type: 'M',
entity_scope: 'Arts & Entertainment',
day: 2,
month: 5,
year: 1989,
address_street: '1 Market St.',
address_city: 'SF',
address_subdivision: 'CA',
address_postal_code: '94114',
address_country_code: 'US',
virtual_docs:[{
document_value: '2222',
document_type: 'SSN'
}],
physical_docs:[{
document_value: 'data:image/gif;base64,SUQs==',
document_type: 'GOVT_ID'
}],
social_docs:[{
document_value: 'https://www.facebook.com/valid',
document_type: 'FACEBOOK'
}]
}]
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.deleteExistingDocument({
documents: [{
id: '<DOC_ID>',
permission_scope: 'DELETE_DOCUMENT'
}]
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To update user's base document:
user.updateUser({
documents: [{
id: '<BASE_DOC_ID>',
email: 'test2@synapsefi.com'
}]
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To update user's sub-document:
user.updateUser({
documents: [{
id: '<BASE_DOC_ID>',
virtual_docs: [{
id: '<SUB_DOC_ID>',
document_value: '111-11-2222',
document_type: 'SSN'
}]
}]
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To verify user's MFA:
user.updateUser({
documents: [{
id: '<BASE_DOC_ID>',
social_docs: [{
id: '<SUB_DOC_ID>',
document_value: '901.111.1111',
document_type: 'PHONE_NUMBER_2FA',
mfa_answer: '123456'
}]
}]
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To lock/remove user:
user.updateUser({
permission: 'MAKE-IT-GO-AWAY'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To get all user's duplicate instances:
user.getUserDuplicates()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To swap one closed user profile with another in instances of duplicate profile:
user.swapDuplicateUsers("6186069048d2fd5ba26f38ee")
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.createNode({
type: 'DEPOSIT-US',
info: {
nickname: 'Test Checking'
}
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.verifyAchMfa('<access_token>', '<mfa_answer>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getAllUserNodes()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
user.getAllUserNodes({
page: 1,
per_page: 5,
type: 'ACH-US'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getNode('<NODE_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
user.getNode('<NODE_ID>', {
'full_dehydrate': 'yes'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getUserTransactions()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
user.getUserTransactions({
page: 2,
per_page: 10,
filter: '{"id": "1245"}'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.triggerDummyTransactions('<NODE_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
user.triggerDummyTransactions('<NODE_ID>', {
amount: 1337,
foreign_transaction: 'no',
is_credit: 'yes',
subnet_id: '5cb8ac9e88a3e200d87e1e52',
type: 'WIRE'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.generateUboForm({
entity_info: {
cryptocurrency: true,
msb: {
federal: true,
states: [
'AL'
]
},
public_company: false,
majority_owned_by_listed: false,
registered_SEC: false,
regulated_financial: false,
gambling: false,
document_id: '<DOC_ID>'
},
signer: {
document_id: '<DOC_ID>',
relationship_to_entity: 'CEO'
},
compliance_contact: {
document_id: '<DOC_ID>',
relationship_to_entity: 'CEO'
},
primary_controlling_contact: {
document_id: '<DOC_ID>',
relationship_to_entity: 'CEO'
},
owners: [
{
document_id: '<DOC_ID>',
title: 'CEO',
ownership: 95
}
]
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getStatementsByUser()
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
user.getStatementsByUser({
page: 2,
per_page: 1
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getStatementsByNode('<NODE_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
user.getStatementsByNode('<NODE_ID>', {
page: 2,
per_page: 1
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.shipCardNode('<NODE_ID>', {
fee_node_id: '<FEE_NODE_ID>'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.resetCardNode('<NODE_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.verifyMicroDeposits('<NODE_ID>', {
micro: [0.1, 0.1]
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.reinitiateMicroDeposits('<NODE_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.updateNode('<NODE_ID>', {
allowed: 'INACTIVE'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.deleteNode('<NODE_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.generateApplePayToken('<NODE_ID>', {
certificate: 'your applepay cert',
nonce: '9c02xxx2',
nonce_signature: '4082f883ae62d0700c283e225ee9d286713ef74'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.createTransaction('<NODE_ID>', {
to: {
type: 'ACH-US',
id: '<NODE_ID>'
},
amount: {
amount: 100.1,
currency: 'USD'
},
extra: {
ip: '127.0.0.1',
note: 'Test transaction'
}
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional idempotency key:
user.createTransaction(
'<NODE_ID>',
{
to: {
type: 'ACH-US',
id: '<NODE_ID>'
},
amount: {
amount: 100.1,
currency: 'USD'
},
extra: {
ip: '127.0.0.1',
note: 'Test transaction'
}
},
'<IDEMPOTENCY_KEY>'
)
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.createBatchTransactions('<NODE_ID>', {
transactions: [
{
"to": {
"type": "DEPOSIT-US",
"id": "5f69275098021636016189ad"
},
"amount": {
"amount": 34,
"currency": "USD"
},
"extra": {
"ip": "127.0.0.1",
"note": "Banking Fees",
"idempotency_key": "testidp1"
}
},
{
"to": {
"type": "DEPOSIT-US",
"id": "5f69275098021636016189ad"
},
"amount": {
"amount": 77,
"currency": "USD"
},
"extra": {
"ip": "127.0.0.1",
"note": "something for 77 dollars US",
"idempotency_key": "testidp2"
}
}
]
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
- Idempotency key is optional
user.getTransaction('<NODE_ID>', '<TRANSACTION_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getAllNodeTransactions('<NODE_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
user.getAllNodeTransactions('<NODE_ID>', {
page: 2,
per_page: 5,
filter: '{"id": "12345"}'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.deleteTransaction('<NODE_ID>', '<TRANSACTION_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.commentOnStatus('<NODE_ID>', '<TRANSACTION_ID>', {
comment: 'add comment'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
For charge backs:
user.disputeCardTransaction('<NODE_ID>', '<TRANSACTION_ID>', {
dispute_reason: 'CHARGE_BACK'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
For charged twice:
user.disputeCardTransaction('<NODE_ID>', '<TRANSACTION_ID>', {
dispute_reason: 'CHARGED_TWICE'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getAllSubnets('<NODE_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
OR to pass in optional query parameters:
user.getAllSubnets('<NODE_ID>', {
page: 2,
per_page: 1
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getSubnet('<NODE_ID>', '<SUBNET_ID>', {
full_dehydrate: true,
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To issue account / routing number:
user.createSubnet('<NODE_ID>', {
nickname: 'Test AC/RT'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To issue debit card:
user.createSubnet('<NODE_ID>', {
nickname: 'My Debit Card',
account_class: 'DEBIT_CARD'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To activate card number:
user.updateSubnet('<NODE_ID>', '<SUBNET_ID>', {
status: 'ACTIVE'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To deactivate card number:
user.updateSubnet('<NODE_ID>', '<SUBNET_ID>', {
status: 'INACTIVE'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To set pin for card:
user.updateSubnet('<NODE_ID>', '<SUBNET_ID>', {
card_pin: 'mlMKMv5+ekyw9M5AtqUBZxgdzj+GEjzddp93qSPw6uRXGpdNiNulVZxcbH1gGGiwEU9UeOwGmgiMaQsDkpbuh3SWY6IxSiPNHI9ryY8z/z+d8MXockQxsKnl1B+ekcLAXx9s2RZM7T6Nfoa+ABGwRV7aFGt91NYaolA0tfU1981J9juB/iljm9cz5JUKDPCxZbn+LW1f4O/5Pt3fDX9Nrre/HsuHtgc7OIu6XTvg1FCm+ds3AkFdHA0dw1aW4j5biXWVEkNpb01PIicANYXtO/AusqH8udBLh0GIU/xNSTzipk/M2hUqoTZdOo7Hu8UZgLbWUEpv7hAAY2tfu/ymsA=='
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To update card preferences:
user.updateSubnet('<NODE_ID>', '<SUBNET_ID>', {
preferences: {
allow_foreign_transactions: true,
daily_atm_withdrawal_limit: 100,
daily_transaction_limit: 1000
}
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
To delete card:
user.updateSubnet('<NODE_ID>', '<SUBNET_ID>', {
status: 'TERMINATED'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.shipCard('<NODE_ID>', '<SUBNET_ID>', {
fee_node_id: '<FEE_NODE_ID>',
expedite: false,
card_style_id: '555'
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getAllCardShipments('<NODE_ID>', '<SUBNET_ID>', {
per_page: 10,
page = 1
})
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.getCardShipment('<NODE_ID>', '<SUBNET_ID>', '<SHIPMENT_ID>' )
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.deleteCardShipment('<NODE_ID>', '<SUBNET_ID>', '<SHIPMENT_ID>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.registerNewFingerprint('<FINGERPRINT_VALUE>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.supplyDevice2FA('<FINGERPRINT_VALUE>', '<2FA_DEVICE>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
user.verifyFingerprint2FA('<FINGERPRINT_VALUE>', '<VALIDATION_PIN>')
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));
POST calls support idempotency for safely retrying requests without accidentally performing the same operation twice. Pass the idempotency key you wish to use as a string as the final argument to the POST call. The only exception to this is the POST Create User call, where you must supply the idempotency key in the options object as shown in the Create User section.
user.createNode(
{
type: 'DEPOSIT-US',
info: {
nickname: 'My Checking'
}
},
'<IDEMPOTENCY_KEY>'
)
.then(({data}) => console.log('DATA\n', data))
.catch(error => console.log(error));