curl -X POST "https://api-sandbox.whitelabel.com/v1/payments/<payment_id>/transactions/<transaction_id>/cancel" \
-H "Content-Type: application/json" \
-H "public-api-key: <public-api-key>" \
-H "private-secret-key: <private-secret-key>" \
-H "X-Idempotency-Key: <X-Idempotency-Key>" \
-d '{
"description": "string",
"reason": "DUPLICATE",
"merchant_reference": "string",
"response_additional_data": {
"receipt": true,
"receipt_language": "ES",
"transactions_history": true,
"raw_request": true,
"raw_response": true
}
}' const response = await fetch ( `https://api-sandbox.whitelabel.com/v1/payments/${ payment_id }/transactions/${ transaction_id }/cancel` , {
method: 'POST' ,
headers: { 'Content-Type' : 'application/json' , 'public-api-key' : '<public-api-key>' , 'private-secret-key' : '<private-secret-key>' , 'X-Idempotency-Key' : '<X-Idempotency-Key>' },
body: JSON . stringify ({
"description" : "string" ,
"reason" : "DUPLICATE" ,
"merchant_reference" : "string" ,
"response_additional_data" : {
"receipt" : true ,
"receipt_language" : "ES" ,
"transactions_history" : true ,
"raw_request" : true ,
"raw_response" : true
}
})
});
const data = await response. json (); import requests
response = requests.request(
"POST" ,
"https://api-sandbox.whitelabel.com/v1/payments/ {payment_id} /transactions/ {transaction_id} /cancel" ,
headers = { "public-api-key" : "<public-api-key>" , "private-secret-key" : "<private-secret-key>" , "X-Idempotency-Key" : "<X-Idempotency-Key>" },
json = {
"description" : "string" ,
"reason" : "DUPLICATE" ,
"merchant_reference" : "string" ,
"response_additional_data" : {
"receipt" : True ,
"receipt_language" : "ES" ,
"transactions_history" : True ,
"raw_request" : True ,
"raw_response" : True
}
},
)
data = response.json() <? php
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL , "https://api-sandbox.whitelabel.com/v1/payments/<payment_id>/transactions/<transaction_id>/cancel" );
curl_setopt ($ch, CURLOPT_RETURNTRANSFER , true );
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST , "POST" );
curl_setopt ($ch, CURLOPT_HTTPHEADER , [ "Content-Type: application/json" , "public-api-key: <public-api-key>" , "private-secret-key: <private-secret-key>" , "X-Idempotency-Key: <X-Idempotency-Key>" ]);
curl_setopt ($ch, CURLOPT_POSTFIELDS , '{
"description": "string",
"reason": "DUPLICATE",
"merchant_reference": "string",
"response_additional_data": {
"receipt": true,
"receipt_language": "ES",
"transactions_history": true,
"raw_request": true,
"raw_response": true
}
}' );
$response = curl_exec ($ch);
curl_close ($ch); package main
import (
" fmt "
" io "
" net/http "
" strings "
)
func main () {
req, _ := http. NewRequest ( "POST" , "https://api-sandbox.whitelabel.com/v1/payments/<payment_id>/transactions/<transaction_id>/cancel" , strings. NewReader ( `{
"description": "string",
"reason": "DUPLICATE",
"merchant_reference": "string",
"response_additional_data": {
"receipt": true,
"receipt_language": "ES",
"transactions_history": true,
"raw_request": true,
"raw_response": true
}
}` ))
req.Header. Set ( "Content-Type" , "application/json" )
req.Header. Set ( "public-api-key" , "<public-api-key>" )
req.Header. Set ( "private-secret-key" , "<private-secret-key>" )
req.Header. Set ( "X-Idempotency-Key" , "<X-Idempotency-Key>" )
resp, err := http.DefaultClient. Do (req)
if err != nil {
panic (err)
}
defer resp.Body. Close ()
data, _ := io. ReadAll (resp.Body)
fmt. Println ( string (data))
} HttpClient client = HttpClient. newHttpClient ();
HttpRequest request = HttpRequest. newBuilder ()
. uri (URI. create ( "https://api-sandbox.whitelabel.com/v1/payments/<payment_id>/transactions/<transaction_id>/cancel" ))
. header ( "Content-Type" , "application/json" )
. header ( "public-api-key" , "<public-api-key>" )
. header ( "private-secret-key" , "<private-secret-key>" )
. header ( "X-Idempotency-Key" , "<X-Idempotency-Key>" )
. method ( "POST" , HttpRequest.BodyPublishers. ofString ( "{ \n \" description \" : \" string \" , \n \" reason \" : \" DUPLICATE \" , \n \" merchant_reference \" : \" string \" , \n \" response_additional_data \" : { \n \" receipt \" : true, \n \" receipt_language \" : \" ES \" , \n \" transactions_history \" : true, \n \" raw_request \" : true, \n \" raw_response \" : true \n } \n }" ))
. build ();
HttpResponse < String > response = client. send (request, HttpResponse.BodyHandlers. ofString ());
System.out. println (response. body ()); require "net/http"
require "uri"
uri = URI ( "https://api-sandbox.whitelabel.com/v1/payments/<payment_id>/transactions/<transaction_id>/cancel" )
http = Net :: HTTP . new (uri. host , uri. port )
http. use_ssl = uri. scheme == "https"
request = Net :: HTTP :: Post . new (uri)
request[ "Content-Type" ] = "application/json"
request[ "public-api-key" ] = "<public-api-key>"
request[ "private-secret-key" ] = "<private-secret-key>"
request[ "X-Idempotency-Key" ] = "<X-Idempotency-Key>"
request. body = "{ \n \" description \" : \" string \" , \n \" reason \" : \" DUPLICATE \" , \n \" merchant_reference \" : \" string \" , \n \" response_additional_data \" : { \n \" receipt \" : true, \n \" receipt_language \" : \" ES \" , \n \" transactions_history \" : true, \n \" raw_request \" : true, \n \" raw_response \" : true \n } \n }"
response = http. request (request)
puts response. body ⧉