> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mygigsters.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate payment link

> This endpoint allows you to create a payment link. (currently only supports AUD currency).

### Headers

**X-API-Version** `string` *required* (default: 1.2)

The API version to use. Supported versions are `1.1` and `1.2`.

### Headers

**idempotency-key** `string` *required*

A unique UUID string used to prevent duplicate operations.

### Request Body Parameters

**amount** `number` *required*

The amount for the payment link in decimal dollars (e.g. to charge \$250.00 AUD, pass 250.00). Do not pass cents.

**currency** `string` *required*

The currency of the payment.

**description** `string` *required*

Description of the payment link.

**expires\_at** `string` *required*

Expiry date and time for the payment link, must be in future.

**reference** `string` *required*

Reference for the payment link.

**title** `string` *required*

Title of the payment link.

**reusable** `boolean`

If true, the payment link can be reused for multiple payments. Defaults to false.

### Response Body

The response for the Generate Payment Link request is a JSON object with the following schema:

**message** `string`

Provides information about the payment link generation process.

**id** `string`

The unique identifier for the generated payment link.

**url** `string`

The URL of the generated payment link.

### Response Codes

| Code | Description |
| - | - |
| 200 | If the request is successful, the payment link is generated and the response includes the link details and URL. |
| 400 | Bad Request. Invalid parameters or invalid amount format. |
| 401 | Unauthorized. Missing or invalid credentials. |
| 409 | Conflict. Duplicate idempotency key with mismatching parameters. |
| 500 | Internal Server Error. |

### Test Card Numbers

| Pan | Brand | Type | Country | Amount | Code | Description | Internal Code | Message |
| - | - | - | - | - | - | - | - | - |
| 4035 5010 0000 0008 | Visa | Debit | US | Any | - | - | - | Successful Payment |
| 2223 0000 4841 0010 | Mastercard | Credit | US | Any | - | - | - | Successful Payment |
| 5354 5631 3425 7854 | Mastercard | Debit | US | Any | - | - | - | Successful Payment |
| 4012 0003 0000 1003 | Visa | Credit | RU | 80.59 | 59 | Suspected Fraud | `issuer_declined` | The issuer declined this transaction. |
| 2223 0000 1018 1375 | Mastercard | Debit | US | 80.05 | 05 | Do not Honor | `issuer_declined` | The issuer declined this transaction. |
| 2223 0000 1018 1375 | Mastercard | Debit | US | 80.51 | 51 | Insufficient Funds | `issuer_declined` | The issuer declined this transaction. |
| 4646 4646 4646 4644 | Visa | Credit | US | Any | N/A | Risk Check Failed | `risk_declined` | Declined by fraud risk engine |
| 1111 1111 1111 1111 | Invalid | Any | N/A | Any | - | - | `validation_error` | The card number is invalid. |

```bash cURL theme={null}
curl -X POST https://qa-payments.mygigsters.com.au/api/v1/create/payment-link \
  -u "YOUR_UUID:YOUR_SECRET" \
  -H "idempotency-Key: e3b0c442-98fc-1c14-9bd4-14f234895678" \
  -H "X-API-Version: 1.2" \
  -H "Content-Type: application/json" \
  -d '{
  "amount": 250,
  "currency": "AUD",
  "description": "Test transaction fee",
  "expires_at": "2025-03-20T16:00:00Z",
  "reference": "0007",
  "title": "INV-0007",
  "reusable": false
}'
```

```javascript Node.js theme={null}
const response = await fetch("https://qa-payments.mygigsters.com.au/api/v1/create/payment-link", {
  method: "POST",
  headers: {
    Authorization: "Basic " + Buffer.from("YOUR_UUID:YOUR_SECRET").toString("base64"),
    "idempotency-Key": "e3b0c442-98fc-1c14-9bd4-14f234895678",
    "X-API-Version": "1.2",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "amount": 250,
    "currency": "AUD",
    "description": "Test transaction fee",
    "expires_at": "2025-03-20T16:00:00Z",
    "reference": "0007",
    "title": "INV-0007",
    "reusable": false
  }),
});

const data = await response.json();
console.log(data);
```

```python Python theme={null}
import requests

response = requests.post(
    "https://qa-payments.mygigsters.com.au/api/v1/create/payment-link",
    auth=("YOUR_UUID", "YOUR_SECRET"),
    headers={
        "idempotency-Key": "e3b0c442-98fc-1c14-9bd4-14f234895678",
        "X-API-Version": "1.2",
    },
    json={
        "amount": 250,
        "currency": "AUD",
        "description": "Test transaction fee",
        "expires_at": "2025-03-20T16:00:00Z",
        "reference": "0007",
        "title": "INV-0007",
        "reusable": False,
    },
)

print(response.json())
```

```ruby Ruby theme={null}
require "net/http"
require "json"
require "uri"

uri = URI("https://qa-payments.mygigsters.com.au/api/v1/create/payment-link")
request = Net::HTTP::Post.new(uri)
request.basic_auth("YOUR_UUID", "YOUR_SECRET")
request["idempotency-Key"] = "e3b0c442-98fc-1c14-9bd4-14f234895678"
request["X-API-Version"] = "1.2"
request["Content-Type"] = "application/json"
request.body = <<~JSON
  {
    "amount": 250,
    "currency": "AUD",
    "description": "Test transaction fee",
    "expires_at": "2025-03-20T16:00:00Z",
    "reference": "0007",
    "title": "INV-0007",
    "reusable": false
  }
JSON

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts JSON.parse(response.body)
```

```php PHP theme={null}
<?php

$ch = curl_init("https://qa-payments.mygigsters.com.au/api/v1/create/payment-link");

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_USERPWD => "YOUR_UUID:YOUR_SECRET",
    CURLOPT_HTTPHEADER => [
        "idempotency-Key: e3b0c442-98fc-1c14-9bd4-14f234895678",
        "X-API-Version: 1.2",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => <<<'JSON'
{
  "amount": 250,
  "currency": "AUD",
  "description": "Test transaction fee",
  "expires_at": "2025-03-20T16:00:00Z",
  "reference": "0007",
  "title": "INV-0007",
  "reusable": false
}
JSON,
]);

$response = curl_exec($ch);
curl_close($ch);

print_r(json_decode($response, true));
```

```java Java theme={null}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;

public class Example {
    public static void main(String[] args) throws Exception {
        String credentials = Base64.getEncoder()
            .encodeToString("YOUR_UUID:YOUR_SECRET".getBytes());

        String body = String.join("\n",
            "{",
            "  \"amount\": 250,",
            "  \"currency\": \"AUD\",",
            "  \"description\": \"Test transaction fee\",",
            "  \"expires_at\": \"2025-03-20T16:00:00Z\",",
            "  \"reference\": \"0007\",",
            "  \"title\": \"INV-0007\",",
            "  \"reusable\": false",
            "}"
        );

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://qa-payments.mygigsters.com.au/api/v1/create/payment-link"))
            .header("Authorization", "Basic " + credentials)
            .header("idempotency-Key", "e3b0c442-98fc-1c14-9bd4-14f234895678")
            .header("X-API-Version", "1.2")
            .header("Content-Type", "application/json")
            .method("POST", HttpRequest.BodyPublishers.ofString(body))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
```

```go Go theme={null}
package main

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

func main() {
	body := strings.NewReader(`{
  "amount": 250,
  "currency": "AUD",
  "description": "Test transaction fee",
  "expires_at": "2025-03-20T16:00:00Z",
  "reference": "0007",
  "title": "INV-0007",
  "reusable": false
}`)

	req, err := http.NewRequest("POST", "https://qa-payments.mygigsters.com.au/api/v1/create/payment-link", body)
	if err != nil {
		panic(err)
	}
	req.SetBasicAuth("YOUR_UUID", "YOUR_SECRET")
	req.Header.Set("idempotency-Key", "e3b0c442-98fc-1c14-9bd4-14f234895678")
	req.Header.Set("X-API-Version", "1.2")
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	data, _ := io.ReadAll(res.Body)
	fmt.Println(string(data))
}
```

```csharp .NET theme={null}
using System.Net.Http.Headers;
using System.Text;

using var client = new HttpClient();

var request = new HttpRequestMessage(HttpMethod.Post, "https://qa-payments.mygigsters.com.au/api/v1/create/payment-link");
request.Headers.Authorization = new AuthenticationHeaderValue(
    "Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes("YOUR_UUID:YOUR_SECRET")));
request.Headers.Add("idempotency-Key", "e3b0c442-98fc-1c14-9bd4-14f234895678");
request.Headers.Add("X-API-Version", "1.2");
request.Content = new StringContent(@"{
  ""amount"": 250,
  ""currency"": ""AUD"",
  ""description"": ""Test transaction fee"",
  ""expires_at"": ""2025-03-20T16:00:00Z"",
  ""reference"": ""0007"",
  ""title"": ""INV-0007"",
  ""reusable"": false
}", Encoding.UTF8, "application/json");

var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

```json Response theme={null}
{
  "message": "Payment link generated",
  "id": "e3299546-884b-4482-a6e5-61171a61d429",
  "url": "https://pay.airwallex.com/sgh5k535cz9m"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.