> This page is for Afterpay Partner API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.afterpay.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.afterpay.com/_mcp/server.

# Enable or Disable Payment Method

PUT https://agencyapi.afterpay.com/v1/onboardings/{onboardingId}/capabilities/lending
Content-Type: application/json

Monthly Payments (MP) is Afterpay's interest-bearing product that allows consumers to split the purchase into 6 to 24 monthly payments. 

All merchants are synchronously enrolled into Afterpay's PM product during the Create an onboarding call. This is based on merchant country, merchant category code (MCC), and agreed-on gating logic between Afterpay and the partner.

Optionally, partners have an option to call this capabilities endpoint to disable PM or enable PM if it has been disabled before.  

Reference: https://developers.afterpay.com/afterpay-partner-api/api-reference/reference-partner-api/capabilities/update-pm-capabilities

## Servers

- `https://agencyapi.afterpay.com` (Production, default)
- `https://agencyapi.sandbox.afterpay.com` (Sandbox)

## Request

### Path parameters

- `onboardingId` (string, required) — The ID returned during a successful Create an onboarding call.

### Headers

- `Accept` (string, required, default: application/json) — Specifies media types that are acceptable for the response.

### Body (application/json)

This endpoint expects an object.

- `lending` (list of V1OnboardingsOnboardingIdCapabilitiesLendingPutRequestBodyContentApplicationJsonSchemaLendingItems, required)

## Response

### 200

Pay Monthly (PM) capability updated successfully.

- `lending` (list of Lending, optional)
- `errors` (list of any, optional) — Shows any errors encountered during the capability enablement.

## Errors

### 503 Service Unavailable Error

Service unavailable.

- `timestamp` (string, optional) — Timestamp of the response.
- `status` (integer, optional) — The HTTP status code.
- `error` (string, optional) — Name of the error that occurred.
- `message` (string, optional) — A human-readable message which provides more details about the error.
- `path` (string, optional) — The attempted endpoint.

## Types

### V1OnboardingsOnboardingIdCapabilitiesLendingPutRequestBodyContentApplicationJsonSchemaLendingItems

- `channel` (string, required) — Defines whether the channel for the capability is online or in-store. Accepted values [Online, In-store].
- `enabled` (boolean, required) — Defines whether the capability is enabled for the above channel.

### Lending

- `channel` (string, required) — Defines whether the channel for the capability is online or in-store. Accepted values [Online, In-store].
- `enabled` (boolean, required) — Defines whether the capability is enabled for the above channel.
- `configuration` (LendingConfiguration, optional)

### LendingConfiguration

- `minimumAmount` (LendingConfigurationMinimumAmount, optional)
- `maximumAmount` (LendingConfigurationMaximumAmount, optional)
- `rateDetails` (list of LendingConfigurationRateDetailsItems, optional)

### LendingConfigurationMinimumAmount

- `amount` (string, optional) — Min amount.
- `currency` (string, optional) — Currency for min amount in the three-letter ISO 4217 currency code.

### LendingConfigurationMaximumAmount

- `amount` (string, optional) — Max amount.
- `currency` (string, optional) — Currency for max amount in the three-letter ISO 4217 currency code.

### LendingConfigurationRateDetailsItems

- `variableRatePercentage` (string, optional) — Variable part of the buy-rate in percentage format e.g. 5.00 for 5%.
- `fixedRate` (string, optional) — Fixed part of the buy-rate e.g. 0.30 for 30 cents.
- `fixedRateCurrencyCode` (string, optional) — Currency of the fixed part of the buy-rate in the three-letter ISO 4217 currency code.
- `rateType` (string, optional) — Type of rate whether introductory for temporary promotional periods or ongoing for steady-state business. Accepted values [INTRODUCTORY, ONGOING].
- `durationInMonths` (integer, optional) — Number of months that the introductory rate will be applied.
- `effectiveFrom` (string, optional) — Effective date and time of when the rate applies.

## Examples

**Request**

```json
{
  "lending": [
    {
      "channel": "ONLINE",
      "enabled": true
    }
  ]
}
```

**Response**

```json
{
  "lending": [
    {
      "channel": "ONLINE",
      "enabled": true,
      "configuration": {
        "minimumAmount": {
          "amount": "200",
          "currency": "USD"
        },
        "maximumAmount": {
          "amount": "4000",
          "currency": "USD"
        },
        "rateDetails": [
          {
            "variableRatePercentage": "5.00",
            "fixedRate": "0.30",
            "fixedRateCurrencyCode": "USD",
            "rateType": "ONGOING",
            "durationInMonths": 1,
            "effectiveFrom": "2023-09-17T21:41:47.341+00:00"
          }
        ]
      }
    }
  ],
  "errors": [
    "string"
  ]
}
```

**SDK Code**

```python
import requests

url = "https://agencyapi.afterpay.com/v1/onboardings/123abcd-456efgh-1124bd/capabilities/lending"

payload = { "lending": [
        {
            "channel": "ONLINE",
            "enabled": True
        }
    ] }
headers = {
    "Accept": "application/json",
    "User-Agent": "User-Agent",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://agencyapi.afterpay.com/v1/onboardings/123abcd-456efgh-1124bd/capabilities/lending';
const options = {
  method: 'PUT',
  headers: {
    Accept: 'application/json',
    'User-Agent': 'User-Agent',
    'Content-Type': 'application/json'
  },
  body: '{"lending":[{"channel":"ONLINE","enabled":true}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://agencyapi.afterpay.com/v1/onboardings/123abcd-456efgh-1124bd/capabilities/lending"

	payload := strings.NewReader("{\n  \"lending\": [\n    {\n      \"channel\": \"ONLINE\",\n      \"enabled\": true\n    }\n  ]\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("User-Agent", "User-Agent")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://agencyapi.afterpay.com/v1/onboardings/123abcd-456efgh-1124bd/capabilities/lending")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Accept"] = 'application/json'
request["User-Agent"] = 'User-Agent'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"lending\": [\n    {\n      \"channel\": \"ONLINE\",\n      \"enabled\": true\n    }\n  ]\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://agencyapi.afterpay.com/v1/onboardings/123abcd-456efgh-1124bd/capabilities/lending")
  .header("Accept", "application/json")
  .header("User-Agent", "User-Agent")
  .header("Content-Type", "application/json")
  .body("{\n  \"lending\": [\n    {\n      \"channel\": \"ONLINE\",\n      \"enabled\": true\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://agencyapi.afterpay.com/v1/onboardings/123abcd-456efgh-1124bd/capabilities/lending', [
  'body' => '{
  "lending": [
    {
      "channel": "ONLINE",
      "enabled": true
    }
  ]
}',
  'headers' => [
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
    'User-Agent' => 'User-Agent',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://agencyapi.afterpay.com/v1/onboardings/123abcd-456efgh-1124bd/capabilities/lending");
var request = new RestRequest(Method.PUT);
request.AddHeader("Accept", "application/json");
request.AddHeader("User-Agent", "User-Agent");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"lending\": [\n    {\n      \"channel\": \"ONLINE\",\n      \"enabled\": true\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Accept": "application/json",
  "User-Agent": "User-Agent",
  "Content-Type": "application/json"
]
let parameters = ["lending": [
    [
      "channel": "ONLINE",
      "enabled": true
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://agencyapi.afterpay.com/v1/onboardings/123abcd-456efgh-1124bd/capabilities/lending")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```