# Making payouts

Source: https://docs.strike.me/walkthrough/making-payouts/

---

## Overview

The Strike API can be used to receive bitcoin payments as US dollars and have those dollars paid-out directly to US bank accounts. This walkthrough shows you how to set up and execute dollar payouts from your Strike account to any US bank account belonging to a person or organization. Currently, payout endpoints are only accessible for select Strike business accounts. Please reach out to partners@strike.me for more information.

## How making a payout works

Making a payout to a US bank account involves specifying the beneficiary’s information, the sender’s information, and the amount to be sent. To begin the process, a bank payment-method must be created, which contains the beneficiary’s necessary account information.

Second, a sender must be determined for the payout. For payouts in which the funds are originating from a third-party, a payout-originator object must be created, detailing that third-party’s information. If the origin of the funds is the owner of the Strike account that's initiating the payout, then the payout-originator object may be omitted, and the Strike account owner's information will be used as the origin of the payout.

Third, a payout object must be created, specifying the desired beneficiary’s payment method, the payout-originator (if applicable), and the dollar amount to be sent. Once the payout object has been successfully created, it can be initiated, causing the payout from your available Strike balance to be sent.

## Integration walkthrough

### 1. Create a bank payment-method
A bank payment-method stores the beneficiary’s banking and personal information necessary for making the payout. A bank payment-method can be created using the [create bank payment-method](https://docs.strike.me/api/create-bank-payment-method) endpoint.

The banking information includes the account number, routing number, account type, transfer type, bank name, and bank address. The beneficiary’s personal information includes their name, address, and type, which can be set either to `INDIVIDUAL` or `COMPANY`, depending if the account holder is a person or organization. You may also include more than one beneficiary, if the bank account is held by joint bank account holders.

Below is an example request to create a new bank payment-method for an `INDIVIDUAL` beneficiary:

```javascript title="Example request:"
curl -L -X POST
'https://<ENVIRONMENT>/v1/payment-methods/bank' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <API_KEY> \
--data-raw '{
  "transferType": "ACH",
  "accountNumber": "1234567890",
  "routingNumber": "123456789",
  "accountType": "CHECKING",
  "bankName": "Chase Bank",
  "bankAddress": {
    "country": "US",
    "state": "TX",
    "city": "Austin",
    "postCode": "73301",
    "line1": "123 Main St"
  },
  "beneficiaries": [
    {
      "dateOfBirth": "1980-03-02",
      "type": "INDIVIDUAL",
      "name": "John Smith",
      "address": {
        "country": "US",
        "state": "TX",
        "city": "Austin",
        "postCode": "73301",
        "line1": "123 Main St"
      }
    },
    {
      "email": "AliceSmith@example.com",
      "phoneNumber": "+15551234567",
      "url": "https://example.com",
      "type": "INDIVIDUAL",
      "name": "Alice Smith",
      "address": {
        "country": "US",
        "state": "TX",
        "city": "Austin",
        "postCode": "73301",
        "line1": "123 Main St"
      }
    }
  ]
}'
```

In the above example, two joint beneficiaries are specified for an ACH transfer to a Texas-based checking account. The optional details of their date of birth, email, phone number, and URL are also included, which can help expedite the set-up process. To use this example yourself, simply replace the placeholder values with your own values. The `<ENVIRONMENT>` should be replaced with `api.strike.me`, and the `<API_KEY>` should be replaced with your actual API key.

Below is an example request to create a new bank payment-method a beneficiary that is an organization:

```javascript title="Example request:"
curl -L -X POST 'https://<ENVIRONMENT>/v1/payment-methods/bank' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <API_KEY> \
--data-raw '{
  "transferType": "US_DOMESTIC_WIRE",
  "accountNumber": "1234567890",
  "routingNumber": "123456789",
  "accountType": "CHECKING",
  "bankName": "Chase Bank",
  "bankAddress": {
    "country": "US",
    "state": "TX",
    "city": "Austin",
    "postCode": "73301",
    "line1": "123 Main St"
  },
  "beneficiaries": [
    {
      "type": "COMPANY",
      "name": "Payments X",
      "address": {
        "country": "US",
        "state": "TX",
        "city": "Austin",
        "postCode": "73301",
        "line1": "123 Main St"
      }
    },
      "email": "finance@pyamentsx.com",
      "phoneNumber": "+15551234567",
      "url": "https://paymentsXexample.com"
    }
  ]
}'
```

In the above example, the bank account beneficiary is a Texas-based company called “Payments X”, and the `transferType` is set to `US_DOMESTIC_WIRE` to a `CHECKING` account.

Please note that each payment-method can have only one `transferType`. If you wish to make a payout to the same payment-method using a different `transferType`, you will need to set up a second payment-method with the different `transferType`.

Below is an example response to the bank payment-method creation request for an individual:

```javascript title="Example response:"
{
  "id": "c8c48059-7263-44d6-836e-16ef9a90f629",
  "state": "READY",
  "created": "2023-04-07T00:26:44.2895946+00:00",
  "transferType": "ACH",
  "accountNumber": "1234567890",
  "routingNumber": "123456789",
  "accountType": "CHECKING",
  "bankName": "Chase Bank",
  "bankAddress": {
    "country": "US",
    "state": "TX",
    "city": "Austin",
    "postCode": "73301",
    "line1": "123 Main St"
  },
  "currency": "USD",
  "beneficiaries": [
    {
      "dateOfBirth": "1988-03-02T00:00:00+00:00",
      "type": "INDIVIDUAL",
      "name": "John Smith",
      "address": {
        "country": "US",
        "state": "TX",
        "city": "Austin",
        "postCode": "73301",
        "line1": "123 Main St"
      }
    },
    {
      "type": "INDIVIDUAL",
      "name": "Alice Smith",
      "address": {
        "country": "US",
        "state": "TX",
        "city": "Austin",
        "postCode": "73301",
        "line1": "123 Main St"
      }
    }
  ]
}
```

In this response, the `id` is the bank payment-method’s ID, which will be needed later on to initiate the payout. Bank payment-methods that have been successfully created will have their `state` set to `READY`. A `PENDING` state may require some additional time to finish processing.

If your payment-method is stuck in a [non-READY](https://docs.strike.me/api/create-bank-payment-method) state, or if you experience any issues, please contact api@strike.me.

To retrieve a list of all the bank payment-methods that are linked to your Strike account, use the [get bank payment-methods](https://docs.strike.me/api/get-bank-payment-methods) endpoint. You can also retrieve specific payment-methods by inputting the ID parameter when using the [get bank payment-methods by id](https://docs.strike.me/api/get-bank-payment-method-by-id) endpoint.

You can also be notified of a payment-method state change by subscribing to the `payment-method.bank.updated` webhook event. When one of your subscribed events occurs, a `POST` request will be automatically made to the webhook URI of the subscription. For details on how to subscribe to events visit the [webhooks section](https://docs.strike.me/webhooks/overview).

### 2. Create a payout-originator
A payout-originator is an object that contains the necessary information on the sender of the payout (the origin of the funds). If the funds originated from a third-party, then a payout-originator object must be created, detailing the necessary information of that third-party. If the origin of the funds is yourself (the owner of the Strike account that's initiating the payout), then the payout-originator object may be omitted, causing your Strike account's information to be used as the origin of the payout.

To create a payment-originator, use the [create payout-originator](https://docs.strike.me/api/create-a-payout-originator/) endpoint, and specify the sender’s name and address. The sender’s type can be set either to `INDIVIDUAL` or `COMPANY`, depending if the sender is a person or organization.

Below is an example request to create a new bank payout-originator, where the sender is an individual:

```javascript title="Example request:"
curl -L -X POST 'https://<ENVIRONMENT>/v1/payout-originators' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <API_KEY> \
--data-raw '{
  "type": "INDIVIDUAL",
  "name": "John Doe",
  "address": {
    "country": "US",
    "state": "TX",
    "city": "Austin",
    "postCode": "73301",
    "line1": "123 Main St"
  },
  "dateOfBirth": "1980-04-07"
}'
```

Below is an example request to create a new payout-originator where the sender is a organization:

```javascript title="Example request:"
curl -L -X POST 'https://<ENVIRONMENT>/v1/payout-originators' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <API_KEY> \
--data-raw '{
  "type": "COMPANY",
  "name": "Payment X company",
  "address": {
    "country": "US",
    "state": "TX",
    "city": "Austin",
    "postCode": "73301",
    "line1": "123 Main St"
  },
    "email": "finance@pyamentsx.com",
    "phoneNumber": "+15551234567",
    "url": "https://example.com"
}'
```

Below is the response to the payout-originator creation request where the sender is an individual:

```javascript title="Example response:"
{
  "id": "e9e2b5b1-7f2a-4dfb-846d-c2f40c98d381",
  "state": "APPROVED",
  "created": "2023-04-07T00:44:56.0414967+00:00",
  "details": {
    "dateOfBirth": "1980-04-07T00:00:00+00:00",
    "type": "INDIVIDUAL",
    "name": "John Doe",
    "address": {
      "country": "US",
      "state": "TX",
      "city": "Austin",
      "postCode": "73301",
      "line1": "123 Main St"
      }
   }
}
```

In this response, the `id` is the payout-originator ID, which will be needed later on to initiate the payout.

To retrieve a list of all the payout-originators that are linked to your Strike account, simply use the [get payout-originators](https://docs.strike.me/api/get-payout-originators) endpoint. You can also retrieve specific payout-originators by inputting the ID parameter when using the [get payout-originator by id](https://docs.strike.me/api/find-payout-originator-by-id) endpoint.

A payout-originator can only be used if it is in the `APPROVED` state. A `PENDING_REVIEW` state may require some additional time to finish processing. If you are unsure why a payout-originator is in one of the other states, please contact api@strike.me.

You can be notified of a state change by subscribing to the `payout-originator.updated` webhook event. When one of your subscribed events occurs, a `POST` request will be automatically made to the webhook URI of the subscription. For details on how to subscribe to events visit the [webhooks section](https://docs.strike.me/webhooks/overview).

### 3. Create a payout object
To initiate the payout, you must create a payout object using the [create a payout](https://docs.strike.me/api/create-a-payout) endpoint. The payout object contains the payment-method ID and payout-originator ID that were set in steps 1 and 2, as well as the dollar amount to be sent. If the payout is originating from yourself, then the payout-originator ID can be omitted, as described in step 2.

When setting the amount for the payout object, ensure that the available balance in your Strike account is greater than the amount of the payout. If you are unsure of your current available balance, use the [get account balance](https://docs.strike.me/api/get-account-balance-details) endpoint to check.

Below is an example request to create a new payout object:

```javascript title="Example request:"
curl -L -X POST 'https://<ENVIRONMENT>/v1/payouts' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <API_KEY> \
--data-raw '{
  "paymentMethodId": "c8c48059-7263-44d6-836e-16ef9a90f629",
  "originatorId": "e9e2b5b1-7f2a-4dfb-846d-c2f40c98d381",
  "amount": "100.00"
}'
```

Below is the response to the payout creation request:

```javascript title="Example response:"
{
  "id": "252652f5-7f3b-4fac-8149-b3c539e608b9",
  "state": "NEW",
  "paymentMethodId": "c8c48059-7263-44d6-836e-16ef9a90f629",
  "originatorId": "e9e2b5b1-7f2a-4dfb-846d-c2f40c98d381",
  "amount": {
    "amount": "100.00",
    "currency": "USD"
  }
}
```

In this response, the `id` is the payout object ID, and the amount has been set to $100.00 USD. The state of this object is set to `NEW`, indicating that the payout is ready to be initiated. If the payout state is not set to `NEW`, there may be something wrong with the payment-method or payout-originator objects.

To retrieve a list of all the payout objects that are linked to your Strike account, use the [get payouts](https://docs.strike.me/api/get-payouts) endpoint. You can also retrieve specific payout objects by inputting the ID parameter when using the [get payouts by id](https://docs.strike.me/api/find-payout-by-id) endpoint.

### 4. Initiate the payout
The final step is to initiate the payout by using the [initiate a payout](https://docs.strike.me/api/initiate-a-payout) endpoint. This endpoint takes the payout object ID that was created in the previous step and requests that it be initiated.

Below is an example request to initiate a payout:

```javascript title="Example request:"
curl -L -X PATCH 'https://<ENVIRONMENT>/v1/payouts/<PayoutId>/initiate' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <API_KEY>
```

Below is the response to the payout initiation request:

```javascript title="Example response:"
{
  "id": "252652f5-7f3b-4fac-8149-b3c539e608b9",
  "state": "INITIATED",
  "paymentMethodId": "c8c48059-7263-44d6-836e-16ef9a90f629",
  "originatorId": "e9e2b5b1-7f2a-4dfb-846d-c2f40c98d381",
  "amount": {
    "amount": "100.00",
    "currency": "USD"
  }
}
```

In this response, the state of the payout object has transitioned to `INITIATED`, indicating a successful payout initiation from your available balance.

Once the payout has been successfully delivered, the payout object’s state will transition to `COMPLETED`. Note that there may be a delay between when the payout’s state transitions to `COMPLETED` and when the beneficiary’s bank shows the funds as received.

Please note, final settlement of funds may take 1-5 business days, depending on the transfer type and receiving bank. If after two business days for a wire transfer and five business days for an ACH transfer, the payout’s state has not yet transitioned to `COMPLETED`, please reach out to api@strike.me.

You can be notified of the payout object’s state changes by subscribing to the `payout.updated` webhook event. When a state change occurs, a POST request will be automatically made to the webhook URI of the subscription. For details on how to subscribe to events visit the [webhooks section](https://docs.strike.me/webhooks/overview).

From the Strike API documentation — https://docs.strike.me
