# Accepting Payments with Connected Accounts

You can accept payments by specifying the ID and authorisation key at the point of accepting payments.&#x20;

## Accepting payments using connected account

<mark style="color:blue;">`GET`</mark> `https://api2.ourpass.co/v1/api/subaccounts/:subaccountId`

#### Path Parameters

| Name                                           | Type   | Description                                                                   |
| ---------------------------------------------- | ------ | ----------------------------------------------------------------------------- |
| subaccountId<mark style="color:red;">\*</mark> | String | This is the unique ID of the connected account to use for accepting payments. |

#### Headers

| Name                                     | Type   | Description                                                   |
| ---------------------------------------- | ------ | ------------------------------------------------------------- |
| apiKey<mark style="color:red;">\*</mark> | String | Pass your api key in the request header to authorise the call |

{% tabs %}
{% tab title="200: OK Response when payment is successful" %}

```javascript
{
    "success": true,
    "message": "Successfully gotten your SubAccount",
    "data": {
        "id": 373,
        "accountId": 35,
        "subAccountEmail": "Hello@gg.io",
        "type": "subaccount",
        "authorizationKeys": "auth_live_XlMZv0eFbEf9S2dF2BVXXTqlMnRVKEiU",
        "txPercentage": 0,
        "txCap": 10,
        "enabled": true,
        "businessId": 155,
        "walletUserMobile": "2348112705999"
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}

```
curl --location --request GET 'https://api2.ourpass.co/v1/api/subaccounts/373' \
--data-raw '{
    "subaccountId": 374
}'
```

{% endtab %}

{% tab title="Node.js" %}

```
var axios = require('axios');
var data = '{\n    "subaccountId": 374\n}';

var config = {
  method: 'get',
  url: 'https://api2.ourpass.co/v1/api/subaccounts/373',
  headers: { },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}

{% tab title="PHP" %}

```
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api2.ourpass.co/v1/api/subaccounts/373');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setBody('{\n    "subaccountId": 374\n}');
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
```

{% endtab %}

{% tab title="Ruby" %}

```
require "uri"
require "net/http"

url = URI("https://api2.ourpass.co/v1/api/subaccounts/373")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request.body = "{\n    \"subaccountId\": 374\n}"

response = http.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="Python" %}

```
import requests

url = "https://api2.ourpass.co/v1/api/subaccounts/373"

payload = "{\n    \"subaccountId\": 374\n}"
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}


---

# 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.ourpass.co/connect/accepting-payments-with-connected-accounts.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.
