# Commit Transaction

{% hint style="danger" %}
This API call must be performed from your backend and not through the JS in the frontend.
{% endhint %}

## Backend verification step to complete the payment

<mark style="color:green;">`POST`</mark> `https://api.sensepass.com/api/transactions/:transactionNumber/commit`

**Authentication options:**&#x20;

Device ID / Merchant API Key + Branch Number / Branch API key

#### Path Parameters

| Name                                                | Type   | Description                                 |
| --------------------------------------------------- | ------ | ------------------------------------------- |
| transactionNumber<mark style="color:red;">\*</mark> | String | transaction number of the ready-transaction |

{% hint style="info" %}
"pay" callback from the SDK contains the transaction number for this API call
{% endhint %}

#### Request Body

| Name                                         | Type   | Description                                                                                                    |     |     |                                                               |
| -------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------- | --- | --- | ------------------------------------------------------------- |
| deviceId                                     | String | location's device id - required if no api key                                                                  |     |     |                                                               |
| methodType<mark style="color:red;">\*</mark> | Enum   | manual\_capture or tokenize or authorize                                                                       |     |     |                                                               |
| apiKey                                       | String | merchant/location api key                                                                                      |     |     |                                                               |
| branchNumber                                 | String | <p>required if merchant api key is used.</p><p>e.g. <code>123</code></p>                                       |     |     |                                                               |
| callbackURL                                  | String | URL (POST/GET) to receive transaction changes                                                                  |     |     |                                                               |
| metadata                                     | Array  | [Metadata Model](/sensepay/transaction-api/models/metadata-model.md)                                           |     |     |                                                               |
| currency                                     | String | <p>Defaults to location's locale.</p><p>USD                                                                    | CAD | EUR | ILS (etc)</p><p>Required for manual\_capture transactions</p> |
| amount                                       |        | <p>Amount in cents.</p><p>Required for <code>manual\_capture</code> or <code>authorize</code> transactions</p> |     |     |                                                               |
| products                                     | Array  | [Product Model](/sensepay/transaction-api/models/product-model.md)                                             |     |     |                                                               |
| receipt                                      | Object | [Receipt Model](/sensepay/transaction-api/models/receipts-model.md)                                            |     |     |                                                               |
| posData                                      | Object | Any object/array you'd like to receive using the callback URL                                                  |     |     |                                                               |

{% tabs %}
{% tab title="200: OK " %}
{% code overflow="wrap" lineNumbers="true" %}

```json
{
    "success": true,
    "transactionNumber": "a4e22734c3f0bae26d8b6e422f71a221f3c7b55c8619e4f338c689f9",
    "transactionStatus": "TransactionApproved",
    "paymentDetails": {
        "type": "Tokenize",
        "paymentMethod": "Credit Card",
        "created": "2023-08-21T13:21:06.407Z",
        "token": "nraag50tyb3i7woz4vt76x4drt72ejs9yjgm7ia3xoc8nx3ywpxxtrzk0dgvkw41ozkqhqi6ozlidmj7i37c4th3db08423fz1evpzpcheoplmvbugen5xf9vxn9i2phlk9hviq3me5a4rko0jykcpj7dzj3337uxzrovff8w3orwrag6kq0luyqgpadts53tazllt70guj1kiuibmgh8mw3m0jeunq7bxjf9cdtnksdgat5gfgwm9umgvjb9ddqp"
    },
    "confirmation": {
        "approvedBy": "Cardknox Sandbox",
        "dateApproval": "2023-08-21T13:21:06.434Z",
        "approvalDate": "2023-08-21T13:21:06.434Z",
        "paymentType": "Regular",
        "sensePassReferenceId": "av7e3z4rgqa9jhaqjlqs",
        "paymentMethodCode": 25,
        "paymentMethodName": "Credit Card",
        "paymentMethodLogo": "https://pay.sandbox.sensepass.com/publicAssets/payment-method/cardknox.png",
        "sourceProvider": {
            "name": "Credit Card",
            "code": 1
        },
        "providerId": "6wMjGG7cJ5KPTvzLOXKTIJjwdREImIsJGNpmGckfBiU=",
        "authNumber": "fh7s94jf8s",
        "acquirer": "hfs7048f4",
        "voucher": "hf7s08opdg",
        "referenceNumber": "ajsh795giyd",
        "amount": 0,
        "confirmationNumber": "174-30243A",
        "fullConfirmationCode": "174-30243A",
        "providerName": "Cardknox Sandbox",
        "cardType": "VISA",
        "lastFourDigits": "1111",
        "cardMask": "411111******1111",
        "expiration": "1234",
        "cardExpiration": "1234",
        "installments": 1,
        "paymentMethod": "Credit Card",
        "Credit Card": {
            "cardType": "VISA",
            "lastFourDigits": "1111",
            "mask": "411111******1111",
            "expiration": "1234"
        },
        "extraDetails": {
            "email": "john@doe.org"
        }
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Example - Manual Capture Response

```json
{
    "success": true,
    "transactionNumber": "a4e22734c3f0bae26d8b6e422f71a221f3c7b55c8619e4f338c689f9",
    "transactionStatus": "TransactionApproved",
    "paymentDetails": {
        "type": "Manual_Capture"
    },
    "confirmation": {
        "approvedBy": "Cardknox Sandbox",
        "dateApproval": "2023-08-21T13:21:06.434Z",
        "approvalDate": "2023-08-21T13:21:06.434Z",
        "paymentType": "Regular",
        "sensePassReferenceId": "av7e3z4rgqa9jhaqjlqs",
        "paymentMethodCode": 25,
        "paymentMethodName": "Credit Card",
        "paymentMethodLogo": "https://pay.sandbox.sensepass.com/publicAssets/payment-method/cardknox.png",
        "sourceProvider": {
            "name": "Credit Card",
            "code": 1
        },
        "providerId": "6wMjGG7cJ5KPTvzLOXKTIJjwdREImIsJGNpmGckfBiU=",
        "authNumber": "fh7s94jf8s",
        "acquirer": "hfs7048f4",
        "voucher": "hf7s08opdg",
        "referenceNumber": "ajsh795giyd",
        "amount": 0,
        "confirmationNumber": "174-30243A",
        "fullConfirmationCode": "174-30243A",
        "providerName": "Cardknox Sandbox",
        "cardType": "VISA",
        "lastFourDigits": "1111",
        "cardMask": "411111******1111",
        "expiration": "1234",
        "cardExpiration": "1234",
        "installments": 1,
        "paymentMethod": "Credit Card",
        "Credit Card": {
            "cardType": "VISA",
            "lastFourDigits": "1111",
            "mask": "411111******1111",
            "expiration": "1234"
        },
        "extraDetails": {
            "email": "john@doe.org"
        }
    }
}
```

### Example - Tokenize Response

```json
{
    "success": true,
    "transactionNumber": "a4e22734c3f0bae26d8b6e422f71a221f3c7b55c8619e4f338c689f9",
    "transactionStatus": "TransactionApproved",
    "paymentDetails": {
        "type": "Tokenize",
        "paymentMethod": "Credit Card",
        "created": "2023-08-21T13:21:06.407Z",
        "token": "nraag50tyb3i7woz4vt76x4drt72ejs9yjgm7ia3xoc8nx3ywpxxtrzk0dgvkw41ozkqhqi6ozlidmj7i37c4th3db08423fz1evpzpcheoplmvbugen5xf9vxn9i2phlk9hviq3me5a4rko0jykcpj7dzj3337uxzrovff8w3orwrag6kq0luyqgpadts53tazllt70guj1kiuibmgh8mw3m0jeunq7bxjf9cdtnksdgat5gfgwm9umgvjb9ddqp"
    },
    "confirmation": {
        "approvedBy": "Cardknox Sandbox",
        "dateApproval": "2023-08-21T13:21:06.434Z",
        "approvalDate": "2023-08-21T13:21:06.434Z",
        "paymentType": "Regular",
        "sensePassReferenceId": "av7e3z4rgqa9jhaqjlqs",
        "paymentMethodCode": 25,
        "paymentMethodName": "Credit Card",
        "paymentMethodLogo": "https://pay.sandbox.sensepass.com/publicAssets/payment-method/cardknox.png",
        "sourceProvider": {
            "name": "Credit Card",
            "code": 1
        },
        "providerId": "6wMjGG7cJ5KPTvzLOXKTIJjwdREImIsJGNpmGckfBiU=",
        "authNumber": "fh7s94jf8s",
        "acquirer": "hfs7048f4",
        "voucher": "hf7s08opdg",
        "referenceNumber": "ajsh795giyd",
        "amount": 0,
        "confirmationNumber": "174-30243A",
        "fullConfirmationCode": "174-30243A",
        "providerName": "Cardknox Sandbox",
        "cardType": "VISA",
        "lastFourDigits": "1111",
        "cardMask": "411111******1111",
        "expiration": "1234",
        "cardExpiration": "1234",
        "installments": 1,
        "paymentMethod": "Credit Card",
        "Credit Card": {
            "cardType": "VISA",
            "lastFourDigits": "1111",
            "mask": "411111******1111",
            "expiration": "1234"
        },
        "extraDetails": {
            "email": "john@doe.org"
        }
    }
}
```

### Example - Authorization Response

```json
{
    "success": true,
    "transactionNumber": "cb3934c8e1be2f1c0bd171105e1b5a4e69a133dd2788d8cf02320142",
    "transactionStatus": "TransactionApproved",
    "paymentDetails": {
        "type": "Authorize",
        "created": "2024-01-03T11:01:10.403Z",
        "token": "o7nmy73bofjrioyuinvdu49qjm00xgb98c7j7d5fpcqm6t9lb7zc6pzpeckp7oron4e336ee4ad9hr650ktz2qt1glbfaf8mp2mvc79negly0rvlpx3pyi7a7696lac3bc29ytb7g6af8a8os1cbvgxf18xk8ozh0lyn7p0myqvurn786jxyf8f0vjhdsgx2840t4esry5nfaf6c93jgaj73iqmpypzsvdolyd0s7v0hh2u4j08u8pmol83xr7y1",
        "authNumber": null,
        "acquirer": null,
        "voucher": null,
        "referenceNumber": null,
        "requestID": "10126600836",
        "approvedBy": "Cardknox Sandbox"
    }
}
```

### Example - Decline

```json
{
    "success": false,
    "transactionNumber": "02b80210dce0b648384e512554a1688b66734c25100b0d3914d93375",
    "transactionStatus": "TransactionDeclined",
    "error": "Invalid Card"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sensepass.com/sensepay/transaction-api/sdk-and-iframes/javascript-ui-sdk/commit-transaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
