Delete Link
Delete a payment link to prevent further payments through that link. Once deleted, the payment URL will no longer be accessible to customers. Existing charges associated with the link are preserved.
Request Parametersโ
Required - 1 fieldRequired Parameters
`link_id`STRING(required)
Link identifier matching pattern /link(_test)?_[0-9a-z]+/. This is provided in the URL path.
Responsesโ
200
Successful deletionLink deleted successfully. Returns the deleted link object with deleted flag set to true.
Response includes:
object- Always returns "link"id- The deleted link's identifierdeleted- Set to true indicating successful deletionlivemode- Production vs test environment indicator
400
Bad requestRequest validation failed. Check the error message for details.
Common causes:
- Link has already been deleted
- Link cannot be deleted due to pending operations
- Invalid request 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
404
Not foundLink not found with the provided ID.
Common causes:
- Invalid link ID format
- Link does not exist
- Link belongs to different account
- Using test key with live link ID (or vice versa)
- Link was already deleted
5xx
Server errorServer-side error occurred. These are rare but should be handled gracefully.
How to handle:
- Retry the request with exponential backoff
- Check status.omise.co for service incidents
- See Error Handling for detailed guidance
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/links/link_test_5xuy4w91xqz7d1w9u0t \
-X DELETE \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
link = Omise::Link.retrieve('link_test_5xuy4w91xqz7d1w9u0t')
link.destroy
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
link = omise.Link.retrieve('link_test_5xuy4w91xqz7d1w9u0t')
link.destroy()
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const result = await omise.links.destroy('link_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$link = OmiseLink::retrieve('link_test_5xuy4w91xqz7d1w9u0t');
$link->destroy();
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Link link = client.links().destroy("link_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var result = await client.Links.Destroy("link_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
link, _ := client.Links().Destroy("link_test_5xuy4w91xqz7d1w9u0t")
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
authentication_failure | Invalid API key | Verify your secret key is correct |
not_found | Link not found | Check link ID is correct and exists |
invalid_link_id | Malformed link ID | Ensure ID matches format link(test)?[0-9a-z]+ |
already_deleted | Link already deleted | Link was previously deleted |
Important Notesโ
| Topic | Description |
|---|---|
| Deletion is permanent | Once deleted, a link cannot be recovered |
| Charges preserved | Existing charges made through the link remain in your account |
| Payment URL disabled | Customers can no longer access the payment page |
| Webhooks | A link.deleted event is triggered upon deletion |
API Credentials
Try it outโ
Required - 1 fields
Your IP:
...Loading...