# Update Link

Updates the expiration time of a payment link identified by its unique ID. Pushing the expiration of an already expired link back into the future makes it active again. A link that is cancelled or finalized answers with a 409. The updated link comes back wrapped in a data object.
**Required scope:** <code style="background:#e8f0fe;color:#1a73e8;padding:2px 8px;border-radius:12px;font-size:0.85em">link:update</code>

Endpoint: PATCH /link/{id}
Version: 2.0
Security: accountId, apiKey

## Path parameters:

  - `id` (string, required)
    Unique identifier of the payment link.

## Request fields (application/json):

  - `expiration_time` (string, required)
    RFC3339 formatted time for the link expiration date

## Response 200 fields (application/json):

  - `data` (object, required)

  - `data.id` (string, required)
    A unique identifier for the resource. While typically formatted as a UUID (Universally Unique Identifier), it can also be in other formats as defined by the user. This field ensures the resource can be distinctly recognized and referenced.

  - `data.created_at` (string, required)
    String with the date on which this Pay By Link was created.
    Example: 2025-06-16T13:32:32Z

  - `data.modified_at` (string)
    String with the date on which this Pay By Link was modified. Omitted while the link has never been modified.
    Example: 2025-06-16T13:32:32Z

  - `data.expiration_time` (string, required)
    The last possible time to make the payment.
    Example: 2026-06-10T09:27:55Z

  - `data.type` (string, required)
    Enum: "SINGLE", "FREQUENT", "SUBSCRIPTION"

  - `data.customer` (object, required)
    The Customer object contains detailed information about the customer required to create a pay-by-link.

  - `data.customer.name` (string, required)
    The full name of the customer. This field is used to identify the customer and personalize interactions. It typically includes the customer's first name and last name.
    Example: Jonh Doe

  - `data.customer.email` (string)
    The email address of the customer. This field is used for communication purposes, including sending transaction confirmations, receipts, and other notifications related to the customer's activities. Omitted when the link was created without a customer email.
    Example: example@easypay.pt

  - `data.customer.phone` (string)
    The contact phone number of the customer, in the E.164 pattern and including the country code indicator (e.g., "+351"). This field is used for communication purposes. If the payment method is MB WAY, the phone is required and is used to send the MB WAY push notification. Omitted when the link was created without a customer phone.
    Example: +351911234567

  - `data.communication_channels` (array, required)
    The communication channels the final customer link was forwarded to. Always present, and empty when the link was created without any channel.

  - `data.payment` (object, required)
    Payment object with the payment methods, capture object and payment type object. Only the payment type you asked for is present.

  - `data.payment.id` (string)
    Identifier of the payment behind this link. Omitted until the payment has been created.

  - `data.payment.methods` (array, required)
    All the payment methods available to create a pay-by-link payment.

  - `data.payment.capture` (object)

  - `data.payment.capture.descriptive` (string)
    A customizable text field for users to input some descriptive associated with this capture operation.

  - `data.payment.capture.key` (string)
    A customizable text field for users to input their own identifier for the resource. This can be any string that helps the user uniquely identify or reference the resource in their own system.

  - `data.payment.single` (object)
    Single object with all the fields necessary after creating a Pay-by-Link request.

  - `data.payment.single.requested_amount` (string, required)
    String representing the monetary amount requested for the transaction. This field is formatted as a double, and will be rounded to two decimal places.
    Example: 10.45

  - `data.payment.frequent` (object)
    Frequent object with all the fields necessary after creating a Pay-by-Link request.

  - `data.payment.frequent.minimum_amount` (string, required)
    Minimum value available to create a Pay-by-link request.
    Example: 5

  - `data.payment.frequent.maximum_amount` (string, required)
    Maximum value available to create a Pay-by-link request.
    Example: 10

  - `data.payment.frequent.unlimited_payments` (boolean, required)
    Determines whether payments can be unlimited.

  - `data.payment.subscription` (object)
    Subscription object with all the fields necessary after creating a Pay-by-Link request.

  - `data.payment.subscription.frequency` (string, required)
    Determines how often the subscription payment is made.
    Enum: "1D", "1W", "2W", "1M", "2M", "3M", "4M", "6M", "1Y", "2Y", "3Y"

  - `data.payment.subscription.maximum_captures` (integer, required)
    The maximum number of captures for this subscription.
    Example: 100

  - `data.payment.subscription.start_time` (string, required)
    The start date of the billing cycles for this subscription.
    Example: 2025-01-15

  - `data.payment.subscription.capture_now` (boolean, required)
    Whether an immediate capture was performed. If this value is true, an immediate capture was performed and the second capture will be on the date in the start_time field.

  - `data.payment.subscription.retries` (integer, required)
    Number of retries in each payment cycle.

  - `data.payment.subscription.failover` (boolean, required)
    After all retries failed, the payment cycle can have another try with another single method.

  - `data.url` (string, required)
    Link that redirects to the Easypay checkout payment page.
    Example: https://easypay.pt/s/XStDvnMKZaN

  - `data.image` (string, required)
    Link that redirects to a QR code to access the payment checkout page.
    Example: https://cdn.easypay.pt/images/qr/XStDvnMKZaN

  - `data.status` (string, required)
    The current state of the payment link. A link starts out ACTIVE, turns EXPIRED once its expiration time passes, becomes FINALIZED after it has been paid, and moves to CANCELLED when you delete it.
    Enum: "ACTIVE", "EXPIRED", "FINALIZED", "CANCELLED"

## Response 400 fields (application/json):

  - `type` (string, required)
    Link that redirects to the API documentation.
    Example: https://docs.easypay.pt/docs/error-handling#invalid-params-error-400

  - `title` (string, required)
    Brief title about the error.
    Example: Invalid payload provided

  - `detail` (string, required)
    Brief description about the error.
    Example: Your request parameters didn't validate

  - `status` (number, required)
    API error code.

  - `invalid_params` (array)
    One entry for each payload field that failed validation. Omitted when the request failed for a reason that isn't tied to a specific field.

  - `invalid_params.name` (string, required)
    Name of the payload field that contains an error.
    Example: expiration_time

  - `invalid_params.reason` (string, required)
    Reason why this payload field contains an error.
    Example: expiration_time should be formatted as RFC 3339 and in the future

## Response 403 fields (application/json):

  - `type` (string, required)
    Link that redirects to the API documentation.
    Example: https://docs.easypay.pt/docs/error-handling#authentication-error-403

  - `title` (string, required)
    Brief title about the error.
    Example: Forbidden

  - `detail` (string, required)
    Brief description about the error.
    Example: Authentication failed

  - `status` (number, required)
    API error code.

## Response 404 fields (application/json):

  - `title` (string, required)
    Brief title about the error.
    Example: Not Found

  - `detail` (string, required)
    Brief description about the error.
    Example: no link found with the provided id

  - `status` (number, required)
    API error code.

## Response 409 fields (application/json):

  - `title` (string, required)
    Brief title about the error.
    Example: Conflict with the current state of the target resource

  - `detail` (string, required)
    Brief description about the error.
    Example: conflict with the resource's current state

  - `status` (number, required)
    API error code.

## Response 500 fields (application/json):

  - `type` (string, required)
    Link that redirects to the API documentation.
    Example: https://docs.easypay.pt/docs/error-handling#internal-error-500

  - `title` (string, required)
    Brief title about the error.
    Example: An unexpected error has occurred

  - `detail` (string, required)
    Brief description about the error.
    Example: An unexpected error has occurred, try again later if the error persists please contact correio@easypay.pt

  - `status` (number, required)
    API error code.

