Create a Link
Create a new payment link with the specified parameters. Links can be shared across any platform and configured for single-use or multiple-use.
API Credentials
Request Parametersโ
Required - 4 fieldsRequired Parameters
`amount`INTEGER(required)
Payment amount in smallest currency unit (satangs for THB, cents for USD). Use 0 to allow customer-specified amounts.
`currency`STRING(required)
ISO 4217 three-letter currency code in lowercase.
`title`STRING(required)
Link name displayed to customers on the payment page.
`description`STRING(required)
Link details and additional context shown to customers.
Recommended - 1 fieldRecommended Parameters
Additional - 1 fieldAdditional Parameters
Responsesโ
200
Successful creationLink created successfully. Returns a complete link object with a payment_uri that can be shared with customers.
Key response fields:
payment_uri- Shareable URL for customers to make paymentused- Indicates if single-use link has been consumedmultiple- Indicates if link allows multiple paymentscharges- List of charges made with this link
400
Bad requestRequest validation failed. Check the error message for details.
Common causes:
- Missing required fields (
amount,currency,title,description) - Invalid currency code
- Invalid amount (negative value)
- Invalid data format
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
- Incorrect HTTP Basic Auth format
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/links \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "amount=100000" \
-d "currency=thb" \
-d "title=Invoice #12345 Payment" \
-d "description=Monthly subscription payment for January 2025"
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
link = Omise::Link.create({
amount: 100000,
currency: 'thb',
title: 'Invoice #12345 Payment',
description: 'Monthly subscription payment for January 2025'
})
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
link = omise.Link.create(
amount=100000,
currency='thb',
title='Invoice #12345 Payment',
description='Monthly subscription payment for January 2025'
)
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const link = await omise.links.create({
amount: 100000,
currency: 'thb',
title: 'Invoice #12345 Payment',
description: 'Monthly subscription payment for January 2025'
});
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$link = OmiseLink::create([
'amount' => 100000,
'currency' => 'thb',
'title' => 'Invoice #12345 Payment',
'description' => 'Monthly subscription payment for January 2025'
]);
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Link link = client.links().create()
.amount(100000L)
.currency("thb")
.title("Invoice #12345 Payment")
.description("Monthly subscription payment for January 2025")
.send();
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var link = await client.Links.Create(new CreateLinkRequest
{
Amount = 100000,
Currency = "thb",
Title = "Invoice #12345 Payment",
Description = "Monthly subscription payment for January 2025"
});
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
link, _ := client.Links().Create(&operations.CreateLink{
Amount: 100000,
Currency: "thb",
Title: "Invoice #12345 Payment",
Description: "Monthly subscription payment for January 2025",
})
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
bad_request | Missing or invalid parameters | Check all required fields are provided |
authentication_failure | Invalid API key | Verify your secret key is correct |
invalid_amount | Amount validation failed | Ensure amount is 0 or positive integer |
invalid_currency | Unsupported currency | Use supported currency codes (thb, jpy, sgd, myr, usd) |
Link Status Fieldsโ
| Field | Description |
|---|---|
used | Single-use link consumption status (true if used) |
multiple | Whether link allows multiple uses |
payment_uri | Shareable URL for customer payment |
Try it outโ
Required - 4 fields
Recommended - 1 fields
Additional - 1 fields