Servise gönderilmesi gereken parametreler şu şekildedir :
Json C# Go Java PHP Python Ruby TypeScript Curl
Copy {
"Date" : "2024-06-13" ,
"MerchantUniqueCode" : "458769387568376459898" ,
"Amount" : 101.5 ,
"MarketPlace" : {
"ProviderCommissionUpdate" : true ,
"Platform" : {
"Decrease" : true ,
"DecreaseAmount" : 101.5
} ,
"Member" : {
"Decrease" : false ,
"DecreaseAmount" : null
}
}
}
Copy using System ;
using System . Net . Http ;
using System . Text ;
using System . Threading . Tasks ;
using Newtonsoft . Json ;
public class Program
{
private static readonly HttpClient client = new HttpClient ();
private static async Task Main ()
{
var data = new
{
Date = "2023-01-23" ,
MerchantUniqueCode = "12222a222a" ,
Amount = 70
};
var content = new StringContent ( JsonConvert . SerializeObject (data) , Encoding . UTF8 , "application/json" );
content . Headers . Add ( "apikeyprivate" , "%PRIVATEKEY%" );
content . Headers . Add ( "apiclientprivate" , "%PRIVATECLIENT%" );
var response = await client . PostAsync ( "{{Private Base Address}}/api/paywall/private/refund/partial" , content);
var responseString = await response . Content . ReadAsStringAsync ();
Console . WriteLine (responseString);
}
}
Copy package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"encoding/json"
)
func main () {
url := "{{Private Base Address}}/api/paywall/private/refund/partial"
data := map [ string ] interface {}{
"Date" : "2023-01-23" ,
"MerchantUniqueCode" : "12222a222a" ,
"Amount" : 70 ,
}
reqBody, _ := json. Marshal (data)
req, _ := http. NewRequest ( "POST" , url, bytes. NewBuffer (reqBody))
req.Header. Set ( "Content-Type" , "application/json" )
req.Header. Set ( "apikeyprivate" , "%PRIVATEKEY%" )
req.Header. Set ( "apiclientprivate" , "%PRIVATECLIENT%" )
client := & http . Client {}
resp, err := client. Do (req)
if err != nil {
panic (err)
}
defer resp.Body. Close ()
body, _ := ioutil. ReadAll (resp.Body)
fmt. Println ( string (body))
}
Copy import java . net . http . HttpClient ;
import java . net . http . HttpHeaders ;
import java . net . http . HttpRequest ;
import java . net . http . HttpResponse ;
import java . net . URI ;
import java . net . http . HttpResponse . BodyHandlers ;
import java . util . HashMap ;
import java . util . Map ;
public class Main {
public static void main ( String [] args) throws Exception {
HttpClient client = HttpClient . newHttpClient ();
Map < String , Object > values = new HashMap < String , Object >() {{
put( "Date" , "2023-01-23" ) ;
put( "MerchantUniqueCode" , "12222a222a" ) ;
put( "Amount" , 70 ) ;
}};
String requestBody = new ObjectMapper() . writeValueAsString (values);
HttpRequest request = HttpRequest . newBuilder ()
. uri ( new URI( "{{Private Base Address}}/api/paywall/private/refund/partial" ) )
. setHeader ( "Content-Type" , "application/json" )
. setHeader ( "apikeyprivate" , "%PRIVATEKEY%" )
. setHeader ( "apiclientprivate" , "%PRIVATECLIENT%" )
. POST ( HttpRequest . BodyPublishers . ofString (requestBody))
. build ();
HttpResponse < String > response = client . send (request , BodyHandlers . ofString ());
System . out . println ( response . body ());
}
}
Copy <? php
$url = '{{Private Base Address}}/api/paywall/private/refund/partial' ;
$data = array (
'Date' => '2023-01-23' ,
'MerchantUniqueCode' => '12222a222a' ,
'Amount' => 70 ,
);
$options = array (
'http' => array (
'header' => "Content-type: application/json\r\n" .
"apikeyprivate: %PRIVATEKEY%\r\n" .
"apiclientprivate: %PRIVATECLIENT%\r\n" ,
'method' => 'POST' ,
'content' => json_encode ( $data ),
) ,
);
$context = stream_context_create ( $options ) ;
$result = file_get_contents ( $url , false , $context ) ;
if ($result === FALSE ) { /* Handle error */ }
var_dump ( $result ) ;
?>
Copy import requests
import json
url = " {{ Private Base Address }} /api/paywall/private/refund/partial"
headers = {
'Content-Type' : 'application/json' ,
'apikeyprivate' : '%PRIVATEKEY%' ,
'apiclientprivate' : '%PRIVATECLIENT%' ,
}
data = {
"Date" : "2023-01-23" ,
"MerchantUniqueCode" : "12222a222a" ,
"Amount" : 70 ,
}
response = requests . post (url, headers = headers, data = json. dumps (data))
print (response. json ())
Copy require 'net/http'
require 'uri'
require 'json'
uri = URI . parse( "{{Private Base Address}}/api/paywall/private/refund/partial" )
http = Net :: HTTP . new (uri . host , uri . port)
request = Net :: HTTP :: Post . new (uri . request_uri , {
'Content-Type' => 'application/json' ,
'apikeyprivate' => '%PRIVATEKEY%' ,
'apiclientprivate' => '%PRIVATECLIENT%' ,
})
request . body = {Date: "2023-01-23" , MerchantUniqueCode: "12222a222a" , Amount: 70 } . to_json
response = http . request(request)
puts response . body
Copy import axios from 'axios' ;
const data = {
Date : "2023-01-23" ,
MerchantUniqueCode : "12222a222a" ,
Amount : 70 ,
};
axios .post ( '{{Private Base Address}}/api/paywall/private/refund/partial' , data , {
headers : {
'Content-Type' : 'application/json' ,
'apikeyprivate' : '%PRIVATEKEY%' ,
'apiclientprivate' : '%PRIVATECLIENT%' ,
}
})
.then ((response) => {
console .log ( response .data);
})
.catch ((error) => {
console .log (error);
});
Copy curl -X POST "{{Private Base Address}}/api/paywall/private/refund/partial" \
-H "Content-Type: application/json" \
-H "apikeyprivate: %PRIVATEKEY%" \
-H "apiclientprivate: %PRIVATECLIENT%" \
-d '{
"Date": "2023-01-23",
"MerchantUniqueCode": "12222a222a",
"Amount": 70
}'