Destroy Signature
To destroy a signature in the NoWallet system, use the following endpoint:
{baseUrl}/destroy/signatureIt is used to cancel one payment just after initiation, if payment is still initiated, it will be cancelled
Request Destroying Signature Parameters
When destroying a signature, the request must include the following parameters in the request body:
When destroying a signature, the request body must include the following parameters in JSON format.
The signature is the unique identifier for the payment to destroy.
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | SignatureDTO | true | none |
Example Request Body
{
"signature": "EXAMPLE-ba325fc6-ca09eb7b4dce"
}
Code Samples in Multiple Languages
To help you integrate the NoWallet API seamlessly, we provide code samples in various programming languages. These examples demonstrate how to make a request to the API endpoint and handle the response.
- Shell (cURL): For quick testing and command-line usage.
- HTTP: Raw HTTP request format for understanding the structure.
- JavaScript: Using
fetchfor browser or Node.js environments. - Ruby: Using the
rest-clientlibrary for Ruby applications. - Python: Using the
requestslibrary for Python projects. - PHP: Using
GuzzleHttpfor PHP integrations. - Java: Using
HttpURLConnectionfor Java applications. - Go: Using the
net/httppackage for Go projects.
Example Request
Below is an example of how to destroy a signature using different languages. Select the tab corresponding to your preferred language to view the implementation.
Ensure you replace {access-token} with your actual API token and provide the required request body parameters.
- cURL
- HTTP
- JavaScript
- Ruby
- Python
- PHP
- Java
- Go
# Example cURL command to destroy a signature
curl -X POST {baseUrl}/destroy/signature \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST {baseUrl}/destroy/signature HTTP/1.1
Content-Type: application/json
Accept: application/json
const inputBody = {
signature: "EXAMPLE-ba325fc6-ca09eb7b4dce",
};
const headers = {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: "Bearer {access-token}",
};
fetch("{baseUrl}/destroy/signature", {
method: "POST",
body: inputBody,
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post '{baseUrl}/destroy/signature',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('{baseUrl}/destroy/signature', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','{baseUrl}/destroy/signature', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("{baseUrl}/destroy/signature");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "{baseUrl}/destroy/signature", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
Response Parameters
The response from the NoWallet API will include the following parameters in JSON format. The statusCode indicates the success or failure of the operation.
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Signature destroyed with successful | None |
| 400 | Bad Request | Bad Request possible errors | None |
Error Response (400 Bad Request)
Bad Request possible errors
{
"statusCode": 400,
"error": "SIGNATURE_NOT_FOUND",
"message": "It seems that this signature does not exist or You can't perform this action, this token does not allow you"
}
{
"statusCode": 400,
"error": "SIGNATURE_ALREADY_CANCELLED",
"message": "This signature has already been cancelled, you cannot cancel it again"
}
{
"statusCode": 400,
"error": "SIGNATURE_ALREADY_CLOSED",
"message": "This signature has already been change state, you cannot cancel it again"
}
Was this page helpful?