Recipients

As the name suggests, recipients are a core part of WePay — the very reason WePay exists is so you can have secure transactions with your recipients. On this page, we'll dive into the different recipient endpoints you can use to manage recipients programmatically. We'll look at how to query, create, update, and delete recipients.

API Base URL: https://staging.wepay.to — Use this in all code examples below.
Support: admin@wepay.to

The recipient model

The recipient model contains all the information about your recipients, such as their username, avatar, and phone number. It also contains a reference to the conversation between you and the recipient and information about when they were last active on WePay.

Properties

FieldTypeDescription
idstring

Unique identifier for the recipient.

namestring

The name for the recipient.

recipientTypestring

The type of recipient. This can be either Individual or Business.

emailstring

The recipient email address.

organizationIdstring

Unique identifier for the organization associated with the recipient.

userIdstring

Unique identifier for the user associated with the recipient.

createdAttimestamp

Timestamp of when the recipient was created.

updatedAttimestamp

Timestamp of when the recipient was last updated.

bankarray

The bank account information for the recipient. Array object with the Bank property.

citystring

City of the recipient.

addressstring

Address of the recipient.

postCodestring

Post code of the recipient.

referencestring

Reference of the recipient.


GET/v1/recipient

List all recipients

This endpoint allows you to retrieve a paginated list of all your recipients. By default, a maximum of ten recipients are shown per page.

Query Params attributes

FieldTypeDescription
limitinteger

Limit the number of recipients returned.

sortstring

Sort the recipients by a specific field. You can sort by createdAt or updatedAt. By default, recipients are sorted by createdAt. You can also sort in reverse order by adding a hyphen (-) before the field you want to sort by.

searchstring

Search for a recipient by name or email.

countrystring

Filter recipients by bank country and currency.

currencystring

Filter recipients by bank country and currency.

Request

GET
/v1/recipient
curl -G "https://staging.wepay.to/v1/recipient?search=example&limit=10&currency=INR&page=1&sort=-createdAt" \
    -H "X-Signature: YOUR_SIGNATURE" \
    -H "X-Timestamp: YOUR_TIMESTAMP" \
    -H "X-Client-ID: YOUR_CLIENT_ID"

Response

{
    "statusCode": 200,
    "message": "getQueryRecipient executed successfully",
    "data": {
        "docs": [
            {
                "name": "XXXXXX",
                "recipientType": "Individual",
                "email": "XXXXXX@example.com",
                "bank": [
                    {
                        "accountName": "XXXXXX",
                        "bankName": "XXXXXX XXXXXX",
                        "accountNumber": 12345678910,
                        "paymentCode": "XXXXXX",
                        "currency": "SGD",
                        "country": "SINGAPORE",
                        "achNumber": "1",
                        "fedwireNumber": "1",
                        "ibanNumber": "1",
                        "accountType": "Checking",
                        "_id": "XXXXXX"
                    }
                ],
                "organizationId": "XXXXXX",
                "userId": "XXXXXX",
                "createdAt": "2023-09-27T09:47:58.526Z",
                "updatedAt": "2023-09-27T09:47:58.526Z",
                "address": "XXXXXX",
                "city": "XXXXXX",
                "postCode": "XXXXXX",
                "reference": "XXXXXX",
                "id": "XXXXXX"
            },
            {
                "name": "XXXXXX",
                "recipientType": "Individual",
                ....
            }
        ],
        "totalDocs": 9,
        "offset": 0,
        "limit": 1,
        "totalPages": 9,
        "page": 1,
        "pagingCounter": 1,
        "hasPrevPage": false,
        "hasNextPage": true,
        "prevPage": null,
        "nextPage": 2
    }
  }

GET/v1/recipient/:id

Get Detail recipients

This endpoint allows you to retrieve a detailed recipient.

Params attributes

FieldTypeDescription
idstring

Id of the recipient.

Request

GET
/v1/recipient/:id
curl -G "https://staging.wepay.to/v1/recipient/:id" \
-H "X-Signature: YOUR_SIGNATURE" \
-H "X-Timestamp: YOUR_TIMESTAMP" \
-H "X-Client-ID: YOUR_CLIENT_ID"

Response

{
    "statusCode": 200,
    "message": "getQueryRecipient executed successfully",
    "data": {
        {
            "name": "XXXXXX",
            "recipientType": "Individual",
            "email": "XXXXXX@example.com",
            "bank": [
                {
                    "accountName": "XXXXXX",
                    "bankName": "XXXXXX XXXXXX",
                    "accountNumber": 12345678910,
                    "paymentCode": "XXXXXX",
                    "currency": "SGD",
                    "country": "SINGAPORE",
                    "achNumber": "1",
                    "fedwireNumber": "1",
                    "ibanNumber": "1",
                    "accountType": "Checking",
                    "_id": "XXXXXX"
                }
            ],
            "organizationId": "XXXXXX",
            "userId": "XXXXXX",
            "createdAt": "2023-09-27T09:47:58.526Z",
            "updatedAt": "2023-09-27T09:47:58.526Z",
            "address": "XXXXXX",
            "city": "XXXXXX",
            "postCode": "XXXXXX",
            "reference": "XXXXXX",
            "id": "XXXXXX"
        }
    }
  }

POST/v1/recipient

Create a recipient

This endpoint allows you to add a new recipient to your recipient list in WePay. To add a recipient, you must provide their WePay name and email also bank country and currency.

Read the statusCode field in the response body rather than the HTTP status code.

For recipient that use for disbursement, you can get bank information from the banks endpoint.

Required attributes

FieldTypeDescription
namestring

The name for the recipient.

emailstring

The recipient email address.

addressstring

The address of recipient.

citystring

The city of recipient.

postCodestring

The post code of recipient.

bank.accountNamestring

The name of the bank account holder.

bank.currencystring

The currency of the bank account.

bank.countrystring

The country of the bank account.

Optional attributes

FieldTypeDescription
recipientTypestring

The name for the recipient.

organizationIdstring

Unique identifier for the organization associated with the recipient.

referencestring

The reference of recipient, you can fill to anything you want to, this fields is only for additional information

bank.bankNamestring

The name of the bank.

bank.accountNumberstring

The bank account number.

bank.paymentCodestring

The payment code for the bank account.

bank.achNumberstring

The ACH number for the bank account.

bank.fedwireNumberstring

The Fedwire number for the bank account.

bank.ibanNumberstring

The IBAN number for the bank account.

bank.accountTypestring

The type of bank account. This can be either Checking or Savings.

Request

POST
/v1/recipient
curl -X POST "https://staging.wepay.to/v1/recipient" \
-H "Content-Type: application/json" \
-H "X-Signature: YOUR_SIGNATURE" \
-H "X-Timestamp: YOUR_TIMESTAMP" \
-H "X-Client-ID: YOUR_CLIENT_ID" \
-d '{
    "name": "XXXXX",
    "recipientType": "Individual",
    "email": "XXXXX@example.com",
    "organizationId": "XXXXX",
    "bank": {
        "currency": "USD",
        "country": "UNITED STATES",
        "accountNumber": "23123232123",
        "accountName": "XXXXX",
        "paymentCode": "XXXXX",
        "bankName": "XXXXX",
        "ifsc": "",
        "ibanNumber": "1",
        "achNumber": "1",
        "fedwireNumber": "1",
        "accountType": "Checking"
    },
    "city": "New York",
    "postCode": "1234",
    "address": "NY Street 123",
    "reference": "XXXXX"
}'

Response

{
    "statusCode": 200,
    "message": "Recipient created successfully",
    "data": {
      "name": "XXXXXX",
      "recipientType": "Individual",
      "email": "XXXXXX@example.com",
      "bank": [
          {
              "accountName": "XXXXXX",
              "bankName": "XXXXXX XXXXXX",
              "accountNumber": 12345678910,
              "paymentCode": "XXXXXX",
              "currency": "SGD",
              "country": "SINGAPORE",
              "achNumber": "1",
              "fedwireNumber": "1",
              "ibanNumber": "1",
              "accountType": "Checking",
              "_id": "XXXXXX"
          }
      ],
      "organizationId": "XXXXXX",
      "userId": "XXXXXX",
      "createdAt": "2023-09-27T09:47:58.526Z",
      "updatedAt": "2023-09-27T09:47:58.526Z",
      "id": "XXXXXX",
      "city": "New York",
      "postCode": "1234",
      "address": "NY Street 123",
      "reference": "XXXXX"
    },
  }

PATCH/v1/recipient/:id

Update a recipient

This endpoint allows you to perform an update on a recipient. Currently, the only attribute that can be updated on recipients is the name attribute which controls how a recipient appears in your recipient list in WePay.

Required attributes

FieldTypeDescription
namestring

The name for the recipient.

emailstring

The recipient email address.

addressstring

The address of recipient. (can't be empty)

citystring

The city of recipient. (can't be empty)

postCodestring

The post code of recipient. (can't be empty)

bank.accountNamestring

The name of the bank account holder.

Optional attributes

FieldTypeDescription
referencestring

The reference of recipient.

bank.currencystring

The currency of the bank account.

bank.countrystring

The country of the bank account.

recipientTypestring

The name for the recipient.

organizationIdstring

Unique identifier for the organization associated with the recipient.

bank.bankNamestring

The name of the bank.

bank.accountNumberstring

The bank account number.

bank.paymentCodestring

The payment code for the bank account.

bank.achNumberstring

The ACH number for the bank account.

bank.fedwireNumberstring

The Fedwire number for the bank account.

bank.ibanNumberstring

The IBAN number for the bank account.

bank.accountTypestring

The type of bank account. This can be either Checking or Savings.

Request

PATCH
/v1/contacts/6511281bc3bfaa8e0df5ff26
curl -X PATCH "https://staging.wepay.to/v1/recipient" \
-H "Content-Type: application/json" \
-H "X-Signature: YOUR_SIGNATURE" \
-H "X-Timestamp: YOUR_TIMESTAMP" \
-H "X-Client-ID: YOUR_CLIENT_ID" \
-d '{
    "name": "XXXXX",
    "bank": {
        "currency": "USD"
    }
}'

Response

{
    "statusCode": 200,
    "message": "Recipient updated successfully",
    "data": {
      "name": "XXXXXX",
      "recipientType": "Individual",
      "email": "XXXXXX@example.com",
      "bank": [
          {
              "accountName": "XXXXXX",
              "bankName": "XXXXXX XXXXXX",
              "accountNumber": 12345678910,
              "paymentCode": "XXXXXX",
              "currency": "SGD",
              "country": "SINGAPORE",
              "achNumber": "1",
              "fedwireNumber": "1",
              "ibanNumber": "1",
              "accountType": "Checking",
              "_id": "XXXXXX"
          }
      ],
      "organizationId": "XXXXXX",
      "userId": "XXXXXX",
      "createdAt": "2023-09-27T09:47:58.526Z",
      "updatedAt": "2023-09-27T09:47:58.526Z",
      "city": "New York",
      "postCode": "1234",
      "address": "NY Street 123",
      "reference": "XXXXX"
      "id": "XXXXXX"
    },
}

DELETE/v1/recipient/:id

Delete a recipient

This endpoint allows you to delete recipient from your recipient list in WePay.

Request

DELETE
/v1/recipient/651602581033ce187867a766
curl -X DELETE "https://staging.wepay.to/v1/recipient?id=651602581033ce187867a766"
-H "Content-Type: application/json" \
-H "X-Signature: YOUR_SIGNATURE" \
-H "X-Timestamp: YOUR_TIMESTAMP" \
-H "X-Client-ID: YOUR_CLIENT_ID"

Response

{
    "statusCode": 200,
    "message": "Recipient deleted successfully",
    "data": {
      "name": "XXXXXX",
      "recipientType": "Individual",
      "email": "XXXXXX@example.com",
      "bank": [
          {
              "accountName": "XXXXXX",
              "bankName": "XXXXXX XXXXXX",
              "accountNumber": 12345678910,
              "paymentCode": "XXXXXX",
              "currency": "SGD",
              "country": "SINGAPORE",
              "achNumber": "1",
              "fedwireNumber": "1",
              "ibanNumber": "1",
              "accountType": "Checking",
              "_id": "XXXXXX"
          }
      ],
      "organizationId": "XXXXXX",
      "userId": "XXXXXX",
      "createdAt": "2023-09-27T09:47:58.526Z",
      "updatedAt": "2023-09-27T09:47:58.526Z",
      "city": "New York",
      "postCode": "1234",
      "address": "NY Street 123",
      "reference": "XXXXX"
      "id": "XXXXXX"
    },
}

Did this page help you ship?