Chilkat Online Tools

SQL Server / GP-API Collection / AUT_1.2 3DS Obtain Result

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

    -- Adds the "Authorization: Bearer <access_token>" header.
    EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'x-gp-version', '{{version}}'

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'QuickRequest', @resp OUT, 'POST', 'https://{{url}}/ucp/authentications/{{aut_id}}/result'
    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
        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


END
GO

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-H "x-gp-version: {{version}}"
https://{{url}}/ucp/authentications/{{aut_id}}/result

Postman Collection Item JSON

{
  "name": "AUT_1.2 3DS Obtain Result",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          "pm.environment.unset(\"aut_value\");\r",
          "pm.environment.unset(\"server_trans_ref\");\r",
          "pm.environment.unset(\"eci\");\r",
          "\r",
          "\r",
          "var jsonData = JSON.parse(responseBody);\r",
          "\r",
          "\r",
          "postman.setEnvironmentVariable(\"aut_value\", jsonData.three_ds.authentication_value);\r",
          "postman.setEnvironmentVariable(\"server_trans_ref\",  jsonData.three_ds.server_trans_ref);\r",
          "postman.setEnvironmentVariable(\"eci\", jsonData.three_ds.eci);"
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "auth": {
      "type": "oauth2",
      "oauth2": [
        {
          "key": "accessToken",
          "value": "{{token}}",
          "type": "string"
        },
        {
          "key": "addTokenTo",
          "value": "header",
          "type": "string"
        }
      ]
    },
    "method": "POST",
    "header": [
      {
        "key": "x-gp-version",
        "value": "{{version}}"
      }
    ],
    "url": {
      "raw": "https://{{url}}/ucp/authentications/{{aut_id}}/result",
      "protocol": "https",
      "host": [
        "{{url}}"
      ],
      "path": [
        "ucp",
        "authentications",
        "{{aut_id}}",
        "result"
      ]
    },
    "description": "This request is the final step before processing the authorization. It is to obtain the necessary authentication data from the Global Payments 3DS solution. \r\n\r\nThis is the data the ACS passed to Global Payments when the customer completed the challenge.\r\n\r\nThe most important information needed for the authorization is the authentication id that is returned in this request. This contains eci value which is needed for a 3DS auth.\r\n\r\nFor more information on Obtaining Result, please visit: https://developer.globalpay.com/api/3d-secure-two and https://developer.globalpay.com/api/authentications#/Get%20Result/get3DSResult"
  },
  "response": [
  ]
}