SQL Server / Bond APIs / 5b. get transaction by customer id
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'customer_id', '{{customer_id}}'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Authorization', '{{authorization}}'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Identity', '{{identity}}'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://{{environment}}.bond.tech/api/v0/transactions', @queryParams
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT @iTmp0
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
END
GO
Curl Command
curl -G -d "customer_id=%7B%7Bcustomer_id%7D%7D"
-H "Authorization: {{authorization}}"
-H "Identity: {{identity}}"
https://{{environment}}.bond.tech/api/v0/transactions
Postman Collection Item JSON
{
"name": "5b. get transaction by customer id",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "{{authorization}}",
"type": "text"
},
{
"key": "Identity",
"value": "{{identity}}",
"type": "text"
}
],
"url": {
"raw": "https://{{environment}}.bond.tech/api/v0/transactions?customer_id={{customer_id}}",
"protocol": "https",
"host": [
"{{environment}}",
"bond",
"tech"
],
"path": [
"api",
"v0",
"transactions"
],
"query": [
{
"key": "customer_id",
"value": "{{customer_id}}"
},
{
"key": "payment_type",
"value": "account",
"disabled": true
}
]
},
"description": "Retrieve Card to Card Transfer"
},
"response": [
{
"name": "example",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "{{authorization}}",
"type": "text"
},
{
"key": "Identity",
"value": "{{identity}}",
"type": "text"
}
],
"url": {
"raw": "https://{{environment}}.bond.tech/api/v0/transactions?customer_id={{customer_id}}",
"protocol": "https",
"host": [
"{{environment}}",
"bond",
"tech"
],
"path": [
"api",
"v0",
"transactions"
],
"query": [
{
"key": "customer_id",
"value": "{{customer_id}}"
},
{
"key": "card_account_id",
"value": "b18f94bc-0d7c-456e-a2e7-19e68393b64f",
"disabled": true
}
]
}
},
"_postman_previewlanguage": "json",
"header": null,
"cookie": [
],
"body": "{\n \"page\": 1,\n \"pages\": 1,\n \"count\": 2,\n \"next_page\": null,\n \"transactions\": [\n {\n \"transaction_id\": \"b9b8da9a-5ff2-4e5c-84ee-587b7d092f6b\",\n \"bond_brand_id\": \"8ed5c9fe-581b-490a-9dcb-3302db235a4b\",\n \"customer_id\": \"6493109c-7cb5-4f21-9d19-d9c3901d452d\",\n \"account_id\": \"9dc86a8a-4c12-4107-84a8-e7cf6a76586f\",\n \"payment_type\": \"card\",\n \"transaction_type\": \"credit\",\n \"previous_transaction_id\": null,\n \"state\": \"pending\",\n \"amount\": \"5.30\",\n \"currency\": \"USD\",\n \"created_time\": \"2021-02-02T22:27:13+00:00\",\n \"updated_time\": \"2021-03-02T20:39:56+00:00\",\n \"balances\": {\n \"prior_balance\": \"68.83\",\n \"new_balance\": \"63.53\"\n },\n \"details\": {\n \"card_id\": \"71efc729-830f-455f-9525-281c19bb4bb4\",\n \"mcc\": \"3542\",\n \"mcc_description\": \"matrix dynamic eyeballs\",\n \"currency\": \"USD\",\n \"exchange_rate\": \"0.00\",\n \"merchant_id\": \"9le8DI5z8am54O3b\",\n \"merchant_name\": \"Baldwin, Wright and Martinez\",\n \"merchant_city\": \"New Nathanshire\",\n \"merchant_state\": \"Missouri\",\n \"merchant_country\": \"Colombia\",\n \"merchant_postal_code\": \"34100\",\n \"cardholder_presence\": true,\n \"statement_descriptor\": \"Target #4744\",\n \"arn\": \"000091556011\",\n \"fraud_rule_triggered\": \"spend_velocity\"\n }\n },\n {\n \"transaction_id\": \"6460856a-e431-4d5f-a6d2-deb87c01042f\",\n \"bond_brand_id\": \"4b3fab91-7b67-4300-95f7-437dacac5e78\",\n \"customer_id\": \"00b9a8ed-03b5-4ce4-a0dd-9bb47aefd2b0\",\n \"account_id\": \"9e5f7953-743d-46d0-88ae-dacc395e8030\",\n \"payment_type\": \"ach\",\n \"transaction_type\": \"credit\",\n \"previous_transaction_id\": null,\n \"state\": \"pending\",\n \"amount\": \"3.22\",\n \"currency\": \"USD\",\n \"created_time\": \"2021-01-17T06:37:44+00:00\",\n \"updated_time\": \"2021-03-04T01:09:46+00:00\",\n \"balances\": {\n \"prior_balance\": \"57.10\",\n \"new_balance\": \"53.88\"\n },\n \"details\": {\n \"card_id\": \"21775c4e-c74e-40e8-83ec-1e2c9781d587\",\n \"external_account_id\": \"d6517906-a318-43b5-849f-0b42032c0a1f\",\n \"class_code\": \"ppd\",\n \"direction\": \"credit\",\n \"network\": \"ach\",\n \"description\": \"Testing\",\n \"failure_reason\": \"Invalid ACH routing number\",\n \"return_code\": \"R13\"\n }\n }\n ]\n}"
}
]
}