# ## Settlement Process After funding a number of transfers over a settlement period, you should then settle for those transfers in bulk. How you do this depends on how refunds are processed for the integration you are building. There are two steps involved in the settlement process: 1. Sending the settlement journal to Wise using API 2. Sending the actual funds to Wise using Bank Transfer Throughout the settlement period you will have called the funding endpoint a number of times to fund transfers. At the end of each settlement period (usually daily), you must run a process to send a journal containing all transfers you wish to settle for to an API endpoint, and then send the total amount of funds to the pre-agreed deposit bank account. The process is given as below: 1. A process should be run to perform settlement, this can be ad hoc or scheduled to run at the same time daily. 2. The process should include: - Query for all transfers that are yet to be settled with Wise. This should be all transfers you have called the funding endpoint for since the previous run of the settlement process. - Query for all completed refunds that are yet to be notified to Wise. This should be all refunded transfers you have been notified using one of the refund methods since the previous run of the settlement process (*Note: This is only applicable for the Net Settlement model.*) 3. Calculate the `balanceTransfer` amount based on the logic in the section above. 4. Get the **Client Credentials Token** in order to call the settlement journal endpoint. (*Note: This is **NOT** a user access token. See [retrieve client credentials token](/api-reference/client-credentials-token#retrieve-client-creds) for an example of how to get this token.*) 5. The settlement journal endpoint should be called first to submit the settlement journal. 6. The exact total amount of funds in the settlement journal should be deposited to Wise, to the pre-agreed deposit bank account, with the same settlement reference used in the settlement journal. Total Settlement Amount Calculation `totalSettlementAmount` = Sum of (`sourceAmount` * `exchangeRate`) The settlement journal API receives the settlement and performs basic verification such as JSON format checks. Additional verification will be performed asynchronously when the transfers are actually settled. ## Send a settlement journal **`POST /v1/settlements`** Sends the settlement journal. There are two types of settlement: - **Same Currency Settlement** - If you settle in the same currency. e.g. settle USD account with USD - **Cross Currency Settlement** - If you settle in a different currency. e.g. settle PHP account with USD. In this case, you will need to specify `settlementCurrency` and `transfers.exchangeRate` fields. Settlement Currency will be the currency you plan to settle in or pay, which is USD for this example. Request Fields type Type of settlement. Always `TRUSTED_BULK_SETTLEMENT`. settlementReference Reference used when paying the end of day settlement monies to Wise to cover all transfers. This should match such that we can link the payment. It can have up to 10 characters and must start with `TPFB` four letter prefix. settlementDate The date you send the settlement funds, ISO8601 format. settlementCurrency (optional) The currency in which the transfers in this journal will be settled. If included, the `exchangeRate` must be set on *every* transfer in the transfers array. **Note: Only include if you will settle in a currency different to the source currency of transfers**. transfers Array of transfers that happened on the `settlementDate`. transfers.id ID of the transfer to be settled. transfers.date The date the transfer was created, ISO8601 format. transfers.sourceAmount Transfer source amount with fee, always positive. transfers.sourceCurrency Transfer source currency. transfers.customerName Name of the customer. Helps to identify customer when manual operation is required. transfers.partnerReference The transaction/payment identifier in your system, uniquely identifies the transfer in your platform. transfers.comment (optional) Other data about the transfer or sender. For USA, you should send the account refund information for the sending customer (account number, routing number, street address, etc.) transfers.exchangeRate (optional) The exchange rate you used to calculate the settlement amount for this transfer. **This is only required if the source currency is different from the settlement currency**. This is a required field if the `settlementCurrency` field has been set for the journal, and it must be set for all transfers. You can set this value to be unique per transfer or the same for every transfer, depending on your settlement approach and agreements with Wise. refundedTransfers Array of transfers which refunds have been processed. Only for Net Settlement. refundedTransfers.id ID of the refunded transfer. refundedTransfers.exchangeRate The exchange rate you used to calculate the settlement amount for this transfer. This should be the same value as the one used for the original transfer settlement. refundedTransfers.partnerReference The transaction/payment identifier in your system, uniquely identifies the transfer in you platform. balanceTransfer The amount of money to be deducted from the expected settlement amount based on what is owed to you for previous days where the total settlement from you to Wise was negative. This value must be 0 or negative. Example Request - Same Currency Settlement ```shell curl -X POST \ https://api.sandbox.transferwise.tech/v1/settlements \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "type": "TRUSTED_BULK_SETTLEMENT", "settlementReference": "TPFB190322", "settlementDate": "2019-03-22T23:59:59-05:00", "transfers": [ { "id": 125678, "date": "2019-03-22T10:00:12-05:00", "sourceAmount": 23.24, "sourceCurrency": "USD", "customerName": "Joe Bloggs", "partnerReference": "11111", "comment": "Extra Data" }, { "id": 178889, "date": "2019-03-23T12:40:05-05:00", "sourceAmount": 125.67, "sourceCurrency": "USD", "customerName": "Mat Newman", "partnerReference": "11112", "comment": "Extra Data" } ], "refundedTransfers": [ { "id": 178880, "partnerReference": "11108" } ], "balanceTransfer": 0 }' ``` Example Request - Cross Currency Settlement ```shell curl -X POST \ https://api.sandbox.transferwise.tech/v1/settlements \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "type": "TRUSTED_BULK_SETTLEMENT", "settlementReference": "TPFB190322", "settlementDate": "2019-03-22T23:59:59-05:00", "settlementCurrency": "USD", "transfers": [ { "id": 125678, "date": "2019-03-22T10:00:12-05:00", "sourceAmount": 23.24, "sourceCurrency": "PHP", "customerName": "Joe Bloggs", "partnerReference": "11111", "comment": "Extra Data", "exchangeRate": 0.875469 }, { "id": 178889, "date": "2019-03-23T12:40:05-05:00", "sourceAmount": 125.67, "sourceCurrency": "PHP", "customerName": "Mat Newman", "partnerReference": "11112", "comment": "Extra Data", "exchangeRate": 0.875469 } ], "refundedTransfers": [ { "id": 178880, "partnerReference": "11108" }, { "id": 178881, "partnerReference": "11109" } ], "balanceTransfer": 0 }' ``` Example Response `HTTP 200` Empty body