# Update a payment

```
PUT 
https://api.freemius.com/v1/products/{product_id}/affiliate_payments/{affiliate_payment_id}.json
```

#### Auth:Bearer TokenSCOPE: <!-- -->PRODUCT

Product-scoped API tokens allow you to operate on the product itself. This token usually allows read-only access to the product configuration and write access to several operations on subscriptions, customers, payments, and more. For most SaaS or app integrations, this is the token you will need.

1. Go to the [Freemius Developer Dashboard](https://dashboard.freemius.com/).
2. Open the Settings page of the relevant product.
3. Click the API & Keys tab.
4. Copy the API Bearer Authorization Token from the UI.

***

Update a specific affiliate payment by its ID.

## Request[​](#request "Direct link to request")

### Path Parameters

* **product\_id**
  <!-- -->
  integer\<int64>[](#param-property-affiliates-update-payment-param-path-product-id "Direct link to product_id")required

  The ID of the product.

  **Possible values:** `>= 1`

  **Example:<!-- -->&#x20;**`1234`

  **affiliate\_payment\_id**
  <!-- -->
  integer\<int64>[](#param-property-affiliates-update-payment-param-path-affiliate-payment-id "Direct link to affiliate_payment_id")required

  The ID of the payment of an affiliate.

  **Possible values:** `>= 1`

  **Example:<!-- -->&#x20;**`1234`

application/json

### Body

* **status**string[](#schema-property-affiliates-update-payment-request-body-status-string "Direct link to status")

  **Default value:<!-- -->&#x20;**`pending`

  **Possible values:** \[`pending`, `rejected`]

## Responses[​](#responses "Direct link to Responses")

* 200
* 400
* 401
* 402
* 404

The updated affiliate payment.

application/json

**Schema**

**id**string\<int64>[](#schema-property-affiliates-update-payment-response-schema-id-string-int64 "Direct link to id")

The unique identifier of the entity.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**created**string\<date-time>[](#schema-property-affiliates-update-payment-response-schema-created-string-date-time "Direct link to created")

The date and time the entity was created, under UTC timezone.

**Example:<!-- -->&#x20;**`2025-01-01 00:00:00`

**updated**string\<date-time>[](#schema-property-affiliates-update-payment-response-schema-updated-string-date-time "Direct link to updated")nullable

The date and time the entity was updated, under UTC timezone. If `null` then the entity was never updated since its creation.

**Example:<!-- -->&#x20;**`2025-01-01 00:00:00`

**user\_id**string\<int64>[](#schema-property-affiliates-update-payment-response-schema-user-id-string-int64 "Direct link to user_id")

The ID of the user the entity belongs to.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**referred\_user\_id**string\<int64>[](#schema-property-affiliates-update-payment-response-schema-referred-user-id-string-int64 "Direct link to referred_user_id")

The ID of the user the entity belongs to.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**affiliate\_id**string\<int64>[](#schema-property-affiliates-update-payment-response-schema-affiliate-id-string-int64 "Direct link to affiliate_id")

The ID of the user the entity belongs to.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**affiliate\_visit\_id**string\<int64>[](#schema-property-affiliates-update-payment-response-schema-affiliate-visit-id-string-int64 "Direct link to affiliate_visit_id")nullable

The ID of the associated affiliate visit. This value is `null` when the payment is attributed through an affiliate coupon rather than a tracked visit.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`12345`

**install\_id**string\<int64>[](#schema-property-affiliates-update-payment-response-schema-install-id-string-int64 "Direct link to install_id")nullable

The ID of the installation or site the entity is associated with, a `null` value means it has not been associated with an installation yet.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**plugin\_id**string\<int64>[](#schema-property-affiliates-update-payment-response-schema-plugin-id-string-int64 "Direct link to plugin_id")

The ID of the product the entity belongs to.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**payment\_id**string\<int64>[](#schema-property-affiliates-update-payment-response-schema-payment-id-string-int64 "Direct link to payment_id")nullable

The ID of the payment associated to the entity.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**commission**integer[](#schema-property-affiliates-update-payment-response-schema-commission-integer "Direct link to commission")

The earnings attributed to an affiliate for a qualifying purchase or payment.

**Example:<!-- -->&#x20;**`12`

**status**string[](#schema-property-affiliates-update-payment-response-schema-status-string "Direct link to status")

**Default value:<!-- -->&#x20;**`pending`

The status of the payment.

**Possible values:** \[`pending`, `rejected`, `paid`, `unpaid`]

**currency**string[](#schema-property-affiliates-update-payment-response-schema-currency-string "Direct link to currency")

3-char currency code.

**Possible values:** `>= 3 characters` and `<= 3 characters`, \[`usd`, `eur`, `gbp`]

**visited\_at**string\<date-time>[](#schema-property-affiliates-update-payment-response-schema-visited-at-string-date-time "Direct link to visited_at")

The date and time the entity was created, under UTC timezone.

**Example:<!-- -->&#x20;**`2025-01-01 00:00:00`

**gross**number\<float>[](#schema-property-affiliates-update-payment-response-schema-gross-number-float "Direct link to gross")

The associated payment amount (not including taxes).

**Example:<!-- -->&#x20;**`2075.45`

**plan\_title**string[](#schema-property-affiliates-update-payment-response-schema-plan-title-string "Direct link to plan_title")

The title of the associated plan.

**Example:<!-- -->&#x20;**`Basic Plan`

**environment**number[](#schema-property-affiliates-update-payment-response-schema-environment-number "Direct link to environment")

The environment the entity belongs to. 0 means it belongs to the production environment, 1 means it belongs to the sandbox environment.

**Possible values:** \[`1`, `0`]

**Example:<!-- -->&#x20;**`0`

**billing\_cycle**number[](#schema-property-affiliates-update-payment-response-schema-billing-cycle-number "Direct link to billing_cycle")

The billing cycle of the subscription in number of months. 1 means monthly, 12 means annually, 0 means lifetime usually when subscriptions are created for lifetime trials.

**Possible values:** \[`1`, `12`, `0`]

**first**string[](#schema-property-affiliates-update-payment-response-schema-first-string "Direct link to first")

The first name of the associated affiliate.

**Example:<!-- -->&#x20;**`John`

**last**string[](#schema-property-affiliates-update-payment-response-schema-last-string "Direct link to last")

The last name of the associated affiliate.

**Example:<!-- -->&#x20;**`Doe`

Bad request. The request could not be understood by the server due to malformed syntax or arguments.

application/json

**Schema**

**path**string[](#schema-property-affiliates-update-payment-response-schema-path-string "Direct link to path")

The API request path.

**Example:<!-- -->&#x20;**`:/products/product_id/users.json`

**error** <!-- -->object

This object contains the error details.

**type**string[](#schema-property-affiliates-update-payment-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

**Example:<!-- -->&#x20;**`UnauthorizedAccess`

**message**string[](#schema-property-affiliates-update-payment-response-schema-message-string "Direct link to message")

The descriptive error message.

**Example:<!-- -->&#x20;**`Some error has occured.`

**code**string[](#schema-property-affiliates-update-payment-response-schema-code-string "Direct link to code")

The error code.

**Example:<!-- -->&#x20;**`unauthorized_access`

**http**integer[](#schema-property-affiliates-update-payment-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

**Example:<!-- -->&#x20;**`401`

**timestamp**string[](#schema-property-affiliates-update-payment-response-schema-timestamp-string "Direct link to timestamp")

Current timestamp.

**Example:<!-- -->&#x20;**`Thu, 11 May 2023 11:45:30 +0000`

**request** <!-- -->object

This object sends back the request payload as received by the server (both from path and from body or query).

**property name\***&#x61;ny[](#schema-property-affiliates-update-payment-response-schema-property-name-any "Direct link to property name*")

This object sends back the request payload as received by the server (both from path and from body or query).

**Example:<!-- -->&#x20;**`{"beautify":true,"format":"json"}`

Unauthorized access error. The request requires [authentication](https://freemius.com/help/api/#bearer-token-authentication) but was not provided or the provided authentication does not satisfy the required permissions.

application/json

**Schema**

**path**string[](#schema-property-affiliates-update-payment-response-schema-path-string "Direct link to path")

The API request path.

**Example:<!-- -->&#x20;**`:/products/product_id/users.json`

**error** <!-- -->object

This object contains the error details.

**type**string[](#schema-property-affiliates-update-payment-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

**Example:<!-- -->&#x20;**`UnauthorizedAccess`

**message**string[](#schema-property-affiliates-update-payment-response-schema-message-string "Direct link to message")

The descriptive error message.

**Example:<!-- -->&#x20;**`Some error has occured.`

**code**string[](#schema-property-affiliates-update-payment-response-schema-code-string "Direct link to code")

The error code.

**Example:<!-- -->&#x20;**`unauthorized_access`

**http**integer[](#schema-property-affiliates-update-payment-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

**Example:<!-- -->&#x20;**`401`

**timestamp**string[](#schema-property-affiliates-update-payment-response-schema-timestamp-string "Direct link to timestamp")

Current timestamp.

**Example:<!-- -->&#x20;**`Thu, 11 May 2023 11:45:30 +0000`

**request** <!-- -->object

This object sends back the request payload as received by the server (both from path and from body or query).

**property name\***&#x61;ny[](#schema-property-affiliates-update-payment-response-schema-property-name-any "Direct link to property name*")

This object sends back the request payload as received by the server (both from path and from body or query).

**Example:<!-- -->&#x20;**`{"beautify":true,"format":"json"}`

The request is missing the specified argument.

application/json

**Schema**

**path**string[](#schema-property-affiliates-update-payment-response-schema-path-string "Direct link to path")

The API request path.

**Example:<!-- -->&#x20;**`:/products/product_id/users.json`

**error** <!-- -->object

This object contains the error details.

**type**string[](#schema-property-affiliates-update-payment-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

**Example:<!-- -->&#x20;**`UnauthorizedAccess`

**message**string[](#schema-property-affiliates-update-payment-response-schema-message-string "Direct link to message")

The descriptive error message.

**Example:<!-- -->&#x20;**`Some error has occured.`

**code**string[](#schema-property-affiliates-update-payment-response-schema-code-string "Direct link to code")

The error code.

**Example:<!-- -->&#x20;**`unauthorized_access`

**http**integer[](#schema-property-affiliates-update-payment-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

**Example:<!-- -->&#x20;**`401`

**timestamp**string[](#schema-property-affiliates-update-payment-response-schema-timestamp-string "Direct link to timestamp")

Current timestamp.

**Example:<!-- -->&#x20;**`Thu, 11 May 2023 11:45:30 +0000`

**request** <!-- -->object

This object sends back the request payload as received by the server (both from path and from body or query).

**property name\***&#x61;ny[](#schema-property-affiliates-update-payment-response-schema-property-name-any "Direct link to property name*")

This object sends back the request payload as received by the server (both from path and from body or query).

**Example:<!-- -->&#x20;**`{"beautify":true,"format":"json"}`

The requested resource was not found.

application/json

**Schema**

**path**string[](#schema-property-affiliates-update-payment-response-schema-path-string "Direct link to path")

The API request path.

**Example:<!-- -->&#x20;**`:/products/product_id/users.json`

**error** <!-- -->object

This object contains the error details.

**type**string[](#schema-property-affiliates-update-payment-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

**Example:<!-- -->&#x20;**`UnauthorizedAccess`

**message**string[](#schema-property-affiliates-update-payment-response-schema-message-string "Direct link to message")

The descriptive error message.

**Example:<!-- -->&#x20;**`Some error has occured.`

**code**string[](#schema-property-affiliates-update-payment-response-schema-code-string "Direct link to code")

The error code.

**Example:<!-- -->&#x20;**`unauthorized_access`

**http**integer[](#schema-property-affiliates-update-payment-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

**Example:<!-- -->&#x20;**`401`

**timestamp**string[](#schema-property-affiliates-update-payment-response-schema-timestamp-string "Direct link to timestamp")

Current timestamp.

**Example:<!-- -->&#x20;**`Thu, 11 May 2023 11:45:30 +0000`

**request** <!-- -->object

This object sends back the request payload as received by the server (both from path and from body or query).

**property name\***&#x61;ny[](#schema-property-affiliates-update-payment-response-schema-property-name-any "Direct link to property name*")

This object sends back the request payload as received by the server (both from path and from body or query).

**Example:<!-- -->&#x20;**`{"beautify":true,"format":"json"}`
