# Get payment link

Retrieve a payment link by code.

To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) you must specify the `/accounts/{accountID}/transfers.read` scope.

## Request Format

### GET

`/accounts/{accountID}/payment-links/{paymentLinkCode}`

### Curl Example

```shell
curl -X GET "https://api.moov.io/accounts/{accountID}/payment-links/{paymentLinkCode}" \
  -H "Authorization: Bearer {token}" \
  -H "X-Moov-Version: v2026.04.00"
```

### JavaScript Example

```typescript
import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.paymentLinks.get({
    accountID: "323f95b1-3798-4203-8a73-5c8668a9226e",
    paymentLinkCode: "uc7ZYKrMhi",
  });

console.log(result);
}

run();
```

### PHP Example

```php
declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;

$sdk = MoovPhp\Moov::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$response = $sdk->paymentLinks->get(
    accountID: '323f95b1-3798-4203-8a73-5c8668a9226e',
    paymentLinkCode: 'uc7ZYKrMhi'
);

if ($response->paymentLink !== null) {
    // handle response
}
```

### Java Example

```java
package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.Security;
import io.moov.sdk.models.operations.GetPaymentLinkResponse;
import java.lang.Exception;

public class Application {
    public static void main(String[] args) throws Exception {
        Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

GetPaymentLinkResponse res = sdk.paymentLinks().get()
                .accountID("323f95b1-3798-4203-8a73-5c8668a9226e")
                .paymentLinkCode("uc7ZYKrMhi")
                .call();

if (res.paymentLink().isPresent()) {
            System.out.println(res.paymentLink().get());
        }
    }
}
```

### Python Example

```python
from moovio_sdk import Moov
from moovio_sdk.models import components

with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:
    res = moov.payment_links.get(account_id="323f95b1-3798-4203-8a73-5c8668a9226e", payment_link_code="uc7ZYKrMhi")
    # Handle response
    print(res)
```

### Ruby Example

```ruby
require 'moov_ruby'

Models = ::Moov::Models
s = ::Moov::Client.new(
  security: Models::Components::Security.new(
    username: '',
    password: ''
  )
)
res = s.payment_links.get(account_id: '323f95b1-3798-4203-8a73-5c8668a9226e', payment_link_code: 'uc7ZYKrMhi')

unless res.payment_link.nil?
  # handle response
end
```

### C# Example

```csharp
using Moov.Sdk;
using Moov.Sdk.Models.Components;

var sdk = new MoovClient(security: new Security() {
    Username = "",
    Password = "",
});

var res = await sdk.PaymentLinks.GetAsync(
    accountID: "323f95b1-3798-4203-8a73-5c8668a9226e",
    paymentLinkCode: "uc7ZYKrMhi"
);

// handle response
```

## Example Response

```json
{
  "amount": {
    "currency": "USD",
    "value": 10000
  },
  "code": "3QLHtONjd5",
  "createdOn": "2025-01-09T17:09:13.33Z",
  "customer": {
    "requirePhone": true,
    "tippingEnabled": true
  },
  "display": {
    "callToAction": "pay",
    "description": "This is an example payment link.",
    "title": "Example Payment Link"
  },
  "link": "https://moov.link/p/3QLHtONjd5",
  "merchantAccountID": "34233b72-780c-4e0e-8b08-cbbe1bc878f8",
  "merchantPaymentMethodID": "4c4e7f8e-81f4-4f3d-8f6f-6f6e7f8e4c4e",
  "mode": "sandbox",
  "ownerAccountID": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "partnerAccountID": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "payment": {
    "allowedMethods": [
      "card-payment",
      "ach-debit-collect"
    ]
  },
  "paymentLinkType": "payment",
  "status": "active",
  "updatedOn": "2025-01-09T17:09:13.33Z",
  "uses": 0
}
```

## Possible Response Errors

- **Missing or Expired Authentication**: The request contained missing or expired authentication.
- **Unauthorized**: The user is not authorized to make the request.
- **Resource Not Found**: The requested resource was not found.
- **Rate Limiting**: Request was refused due to rate limiting.
- **Unexpected Error**: The request failed due to an unexpected error.
- **Service Failure**: The request failed because a downstream service failed to respond.

## API Versioning

Set the header to `v2026.04.00` to use the API described in this specification. When omitted, the server defaults to `v2024.01.00`.
