DAPI direct API flow

Below you can find 2 flows:

HOLD - POST flow

Take the following steps: 1.Generate token

Generate a token using the “Generate external token” API. In this API you need to pass your NymCard account ID and pass "DAPI" channel. You will receive the token itself and timestamp, which indicates when this token will expire. Expiration time is 60 minutes.

Here you can find request sample:

POST /accounts/{id}:token

{

"channel": "DAPI"

}

Here you can find response sample:

Response sample

{

"token": "42504465-5410-46fc-94e8-aa5bc062ada9%7Ctenant",

"expiry": 3600

}

2.Load Account Funds with Token API: Request [HOLD]

Upon performing “HOLD”, the amount will be set to hold for the prefunded (pool) account and no funds will be credited to the cardholder account yet.

Perform the following API:

curl --location 'api.dev.platform.nm-1.nymcard.com/internal/v1/accounts:loadFunds' \
--header 'X-Nymos-Idempotency-Key: ida957795' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json;charset=UTF-8' \
--header 'apikey: tenant1-key' \
--data '{
    "channel": "DAPI",
    "type": "HOLD", 
    "token": "ZOJal3wB5A5FzyQAwOmrdntn-gt6Od1-GQaPVbX0Id9E1UTCUbMTUUOIAhnQbDhEhwGppg88FgJgmBepZCNGnA==",
    "amount": 19, 
    "dry_run": false
  
}'

You will get the following response:

{
    "reference_number": "SUNY3165110617H"
}

Also you will receive the following webhook:

{
  "event": "TRANSACTION",
  "card_transaction": {
    "id": "5ec9f345-fd8d-403b-9952-0632e01ffb4c",
    "transaction_timestamp": "2023-06-14T11:06:17.769Z",
    "message_type": "API",
    "transaction_type": "WALLET_TRANSFER",
    "transaction_description": "Wallet Transfer",
    "user_id": "MuhayUdDinTestForSashi_14JUNE23_00",
    "account_id1": "77779999999999999271",
    "card_product1": "Description of the cardproducthk105",
    "account_id2": "MUHAYTestingAcct14JUNE_00",
    "card_product2": "MUHAY TESTING CP 12MAY23_01",
    "rrn": "3165110618GU",
    "reference_number": "SUNY3165110617H",
    "transaction_amount": 19,
    "transaction_currency": "AED",
    "fee_amount": 0,
    "fee_details": [],
    "status_code": "0000",
    "transfer_id": "5ec9f345-fd8d-403b-9952-0632e01ffb4c",
    "reversal_count": 0,
    "clearing_count": 0,
    "sender_user_id": "hkbusiness36",
    "source_channel": "DAPI",
    "type": "HOLD"
  }
}

3.Load Account Funds with Token API: Request [POST]

Upon performing “POST”, the amount will be debited from the prefunded (pool) account and credited to the cardholder account.

Perform the following API:

curl --location 'api.dev.platform.nm-1.nymcard.com/internal/v1/accounts:loadFunds' \
--header 'X-Nymos-Idempotency-Key: ida957798' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json;charset=UTF-8' \
--header 'apikey: tenant1-key' \
--data '{
    "channel": "DAPI",
    "type": "POST", 
    "token": "ZOJal3wB5A5FzyQAwOmrdntn-gt6Od1-GQaPVbX0Id9E1UTCUbMTUUOIAhnQbDhEhwGppg88FgJgmBepZCNGnA==",
    "amount": 19, 
    "dry_run": false,
    
    "external_reference_number": "MUHAY04" 
}'

You will get the following response:

{
    "reference_number": "SUNY3165110617H"
}

Webhooks

Upon performing “POST”, two webhooks will be received. One is for original transaction and another one is for completion.

Webhook 1

{
  "event": "TRANSACTION",
  "card_transaction": {
    "id": "5ec9f345-fd8d-403b-9952-0632e01ffb4c",
    "transaction_timestamp": "2023-06-14T11:06:17.769Z",
    "message_type": "API",
    "transaction_type": "WALLET_TRANSFER",
    "transaction_description": "Wallet Transfer",
    "user_id": "MuhayUdDinTestForSashi_14JUNE23_00",
    "account_id1": "77779999999999999271",
    "card_product1": "Description of the cardproducthk105",
    "account_id2": "MUHAYTestingAcct14JUNE_00",
    "card_product2": "MUHAY TESTING CP 12MAY23_01",
    "rrn": "3165110618GU",
    "reference_number": "SUNY3165110617H",
    "transaction_amount": 19,
    "transaction_currency": "AED",
    "fee_amount": 0,
    "fee_details": [],
    "status_code": "0000",
    "transfer_id": "5ec9f345-fd8d-403b-9952-0632e01ffb4c",
    "reversal_count": 0,
    "clearing_count": 1,
    "sender_user_id": "hkbusiness36",
    "source_channel": "DAPI",
    "type": "HOLD"
  }
}

Webhook 2

{
  "event": "TRANSACTION",
  "card_transaction": {
    "id": "ef21bf40-6127-4430-a8c5-bdece20b776a",
    "transaction_timestamp": "2023-06-14T11:11:32.938Z",
    "parent_transaction_id": "5ec9f345-fd8d-403b-9952-0632e01ffb4c",
    "message_type": "API",
    "transaction_type": "WALLET_TRANSFER",
    "transaction_description": "Wallet Transfer",
    "user_id": "MuhayUdDinTestForSashi_14JUNE23_00",
    "account_id1": "77779999999999999271",
    "card_product1": "Description of the cardproducthk105",
    "account_id2": "MUHAYTestingAcct14JUNE_00",
    "card_product2": "MUHAY TESTING CP 12MAY23_01",
    "rrn": "3165111133GE",
    "reference_number": "SUNY3165110617H",
    "transaction_amount": 19,
    "transaction_currency": "AED",
    "fee_amount": 0,
    "fee_details": [],
    "status_code": "0000",
    "transfer_id": "ef21bf40-6127-4430-a8c5-bdece20b776a",
    "settlement_status": "MATCHED",
    "reversal_count": 0,
    "clearing_count": 0,
    "sender_user_id": "hkbusiness36",
    "source_channel": "DAPI",
    "external_reference_number": "MUHAY04",
    "type": "POST"
  }
}

HOLD - RELEASE flow

Take the following steps: 1.Generate token

Generate a token using the “Generate external token” API. In this API you need to pass your NymCard account ID and pass "DAPI" channel. You will receive the token itself and timestamp, which indicates when this token will expire. Expiration time is 60 minutes.

Here you can find request sample:

POST /accounts/{id}:token

{

"channel": "DAPI"

}

Here you can find response sample:

Response sample

{

"token": "42504465-5410-46fc-94e8-aa5bc062ada9%7Ctenant",

"expiry": 3600

}

2.Load Account Funds with Token API: Request [HOLD]

Upon performing “HOLD”, the amount will be set to hold for the prefunded (pool) account and no funds will be credited to the cardholder account yet.

Perform the following API:

curl --location 'api.dev.platform.nm-1.nymcard.com/internal/v1/accounts:loadFunds' \
--header 'X-Nymos-Idempotency-Key: ida957795' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json;charset=UTF-8' \
--header 'apikey: tenant1-key' \
--data '{
    "channel": "DAPI",
    "type": "HOLD", 
    "token": "ZOJal3wB5A5FzyQAwOmrdntn-gt6Od1-GQaPVbX0Id9E1UTCUbMTUUOIAhnQbDhEhwGppg88FgJgmBepZCNGnA==",
    "amount": 19, 
    "dry_run": false
  
}'

You will get the following response:

{
    "reference_number": "SUNY3165112536b"
}

Also you will receive the following webhook:

{
  "event": "TRANSACTION",
  "card_transaction": {
    "id": "882863d4-aff6-48e2-aa4c-12d1e9591327",
    "transaction_timestamp": "2023-06-14T11:25:36.913Z",
    "message_type": "API",
    "transaction_type": "WALLET_TRANSFER",
    "transaction_description": "Wallet Transfer",
    "user_id": "MuhayUdDinTestForSashi_14JUNE23_00",
    "account_id1": "77779999999999999271",
    "card_product1": "Description of the cardproducthk105",
    "account_id2": "MUHAYTestingAcct14JUNE_00",
    "card_product2": "MUHAY TESTING CP 12MAY23_01",
    "rrn": "3165112537Lm",
    "reference_number": "SUNY3165112536b",
    "transaction_amount": 23,
    "transaction_currency": "AED",
    "fee_amount": 0,
    "fee_details": [],
    "status_code": "0000",
    "transfer_id": "882863d4-aff6-48e2-aa4c-12d1e9591327",
    "reversal_count": 0,
    "clearing_count": 0,
    "sender_user_id": "hkbusiness36",
    "source_channel": "DAPI",
    "type": "HOLD"
  }
}

3.Load Account Funds with Token API: Request [RELEASE]

Upon performing “RELEASE”, amount will be released back into the prefunded (pool) account.

Note, that we can not perform “RELEASE“ on a transaction which is already completed.

Perform the following API:

curl --location 'api.dev.platform.nm-1.nymcard.com/internal/v1/accounts:loadFunds' \
--header 'X-Nymos-Idempotency-Key: ida957802' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json;charset=UTF-8' \
--header 'apikey: tenant1-key' \
--data '{
    "channel": "DAPI",
    "type": "RELEASE", 
    "token": "_qvvrgNwDuu077cXSXcOXn8ggowqRrsucG4-jhaE_zQRFQ5HH3m3tiro1kU73Gvsuf-0Dts5VkTLUYUysHegvg==",
    "amount": 23, 
    "dry_run": false,
     "error_description" : "Test Error Description 02 Muhay" 
    
}'

You will get the following response:

{
    "reference_number": "SUNY3165112536b"
}

Webhooks

On performing “RELEASE”, two webhooks will be received. One is for original transaction and another one is for reversal transaction.

Webhook 1

{
  "event": "TRANSACTION",
  "card_transaction": {
    "id": "882863d4-aff6-48e2-aa4c-12d1e9591327",
    "transaction_timestamp": "2023-06-14T11:25:36.913Z",
    "message_type": "API",
    "transaction_type": "WALLET_TRANSFER",
    "transaction_description": "Wallet Transfer",
    "user_id": "MuhayUdDinTestForSashi_14JUNE23_00",
    "account_id1": "77779999999999999271",
    "card_product1": "Description of the cardproducthk105",
    "account_id2": "MUHAYTestingAcct14JUNE_00",
    "card_product2": "MUHAY TESTING CP 12MAY23_01",
    "rrn": "3165112537Lm",
    "reference_number": "SUNY3165112536b",
    "transaction_amount": 23,
    "transaction_currency": "AED",
    "fee_amount": 0,
    "fee_details": [],
    "status_code": "0000",
    "transfer_id": "882863d4-aff6-48e2-aa4c-12d1e9591327",
    "reversal_count": 1,
    "clearing_count": 0,
    "sender_user_id": "hkbusiness36",
    "source_channel": "DAPI",
    "type": "HOLD"
  }
}

Webhook 2

{
  "event": "TRANSACTION",
  "card_transaction": {
    "id": "493be65a-17b3-4e52-a91e-c84d432ccc53",
    "transaction_timestamp": "2023-06-14T11:27:06.718Z",
    "parent_transaction_id": "882863d4-aff6-48e2-aa4c-12d1e9591327",
    "message_type": "API",
    "transaction_type": "WALLET_TRANSFER",
    "transaction_description": "Wallet Transfer",
    "user_id": "MuhayUdDinTestForSashi_14JUNE23_00",
    "account_id1": "77779999999999999271",
    "card_product1": "Description of the cardproducthk105",
    "account_id2": "MUHAYTestingAcct14JUNE_00",
    "card_product2": "MUHAY TESTING CP 12MAY23_01",
    "rrn": "3165112706Od",
    "reference_number": "SUNY3165112536b",
    "transaction_amount": 23,
    "transaction_currency": "AED",
    "fee_amount": 0,
    "fee_details": [],
    "status_code": "0000",
    "transfer_id": "493be65a-17b3-4e52-a91e-c84d432ccc53",
    "reversal_count": 0,
    "clearing_count": 0,
    "sender_user_id": "hkbusiness36",
    "source_channel": "DAPI",
    "type": "RELEASE"
  }
}

Last updated