Create payment link
Creates a new payment link for an existing transaction. The new link is associated with the transaction and triggers all active merchant webhooks subscribing to the `payment_link.created` event. The webhook POSTs a JSON payload with the payment link data, the associated transactionId, and an HMAC SHA256 signature in the `X-Katu9-Signature` header.
Authorization
AuthorizationRequiredBearer <token>In: header
Request Body
application/jsonRequiredtransactionIdRequiredstring"uuid"amountnumberAmount for the payment link (optional, defaults to transaction amount)
currencystringCurrency (optional, defaults to transaction currency)
expiryMinutesintegerLink expiry in minutes (optional, defaults to 60)
redirectUrlstringRedirect URL after payment (optional)
descriptionstringDescription for the payment link (optional)
Response Body
Payment link created successfully
TypeScript Definitions
Use the response body type in TypeScript.
dataRequiredobjectInvalid request parameters
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectUnauthorized
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectTransaction not found or unauthorized
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectA non-expired payment link already exists for this transaction in this environment.
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredobjectcurl -X POST "https://api.katu9.com/payment-link/generate" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
"amount": 0,
"currency": "string",
"expiryMinutes": 0,
"redirectUrl": "string",
"description": "string"
}'const body = JSON.stringify({
"transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
"amount": 0,
"currency": "string",
"expiryMinutes": 0,
"redirectUrl": "string",
"description": "string"
})
fetch("https://api.katu9.com/payment-link/generate", {
headers: {
"Authorization": "Bearer <token>"
},
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://api.katu9.com/payment-link/generate"
body := strings.NewReader(`{
"transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
"amount": 0,
"currency": "string",
"expiryMinutes": 0,
"redirectUrl": "string",
"description": "string"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://api.katu9.com/payment-link/generate"
body = {
"transactionId": "75906707-8c31-479c-b354-aa805c4cefbc",
"amount": 0,
"currency": "string",
"expiryMinutes": 0,
"redirectUrl": "string",
"description": "string"
}
response = requests.request("POST", url, json = body, headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
})
print(response.text){
"data": {
"paymentLink": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"expiresAt": "2019-08-24T14:15:22Z",
"amount": 0,
"currency": "string",
"status": "string",
"redirectUrl": "http://example.com"
}
}
}{
"error": {
"message": "string",
"details": {}
}
}{
"error": {
"message": "string",
"details": {}
}
}{
"error": {
"message": "string",
"details": {}
}
}{
"error": {
"message": "A non-expired payment link already exists for this transaction in this environment."
}
}