3D Secure Başlatma (Init 3Ds)
Bu method HTTP Form POST methodu ile çal ışmaktadır. Bu methoda özel kimlik doğrulama esnasında anlatılan bilgiler header üzerinde değil doğrudan form-data şeklinde gönderilmelidir.
POSThttps://testpfapi.rubikpara.com/v1/ThreeDS/init3ds
Request
Body
Dikkat
Bilgiler multipart/form-data formatında gönderilmelidir!
{
"threeDSessionId": "string",
"callbackUrl": "string",
"languageCode": "string",
"clientIpAddress": "string",
"publicKey": "string",
"nonce": "string",
"signature": "string",
"conversationId": "string",
"merchantNumber": "string",
"cardHolderName" : "string"
}
Response
Body
{
"isSucceed": "boolean",
"errorCode": "string or null",
"errorMessage": "string or null",
"conversationId": "string or null",
"htmlContent": "string or null"
}
Örnek Kodlar
- Axios
- Java
- PHP
- C#
- Go
- Python
- cURL
const axios = require('axios'); const FormData = require('form-data'); let data = new FormData(); data.append('ThreeDSessionId', ''); data.append('CallbackUrl', 'https://www.google.com'); data.append('LanguageCode', 'TR'); data.append('ClientIpAddress', '192.1.1.1'); data.append('PublicKey', 'SkDP+k0jpMPDOzjcQ2dTcg=='); data.append('Nonce', ''); data.append('Signature', ''); data.append('ConversationId', 'test123456'); data.append('MerchantNumber', '1100000001'); data.append('CardHolderName', 'Umut Can'); let config = { method: 'post', maxBodyLength: Infinity, url: 'https://testpfapi.rubikpara.com/v1/threeds/init3ds', headers: { 'Content-Type': 'multipart/form-data' }, data : data }; axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); });
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("ThreeDSessionId","")
.addFormDataPart("CallbackUrl","https://www.google.com")
.addFormDataPart("LanguageCode","TR")
.addFormDataPart("ClientIpAddress","192.1.1.1")
.addFormDataPart("PublicKey","SkDP+k0jpMPDOzjcQ2dTcg==")
.addFormDataPart("Nonce","")
.addFormDataPart("Signature","")
.addFormDataPart("ConversationId","test123456")
.addFormDataPart("MerchantNumber","1100000001")
.build();
Request request = new Request.Builder()
.url("https://testpfapi.rubikpara.com/v1/threeds/init3ds")
.method("POST", body)
.build();
Response response = client.newCall(request).execute();
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://testpfapi.rubikpara.com/v1/threeds/init3ds',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('ThreeDSessionId' => '','CallbackUrl' => 'https://www.google.com','LanguageCode' => 'TR','ClientIpAddress' => '192.1.1.1','PublicKey' => 'SkDP+k0jpMPDOzjcQ2dTcg==','Nonce' => '','Signature' => '','ConversationId' => 'test123456','MerchantNumber' => '1100000001'),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://testpfapi.rubikpara.com/v1/threeds/init3ds");
var content = new MultipartFormDataContent();
content.Add(new StringContent(""), "ThreeDSessionId");
content.Add(new StringContent("https://www.google.com"), "CallbackUrl");
content.Add(new StringContent("TR"), "LanguageCode");
content.Add(new StringContent("192.1.1.1"), "ClientIpAddress");
content.Add(new StringContent("SkDP+k0jpMPDOzjcQ2dTcg=="), "PublicKey");
content.Add(new StringContent(""), "Nonce");
content.Add(new StringContent(""), "Signature");
content.Add(new StringContent("test123456"), "ConversationId");
content.Add(new StringContent("1100000001"), "MerchantNumber");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
package main
import (
"fmt"
"bytes"
"mime/multipart"
"net/http"
"io/ioutil"
)
func main() {
url := "https://testpfapi.rubikpara.com/v1/threeds/init3ds"
method := "POST"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
_ = writer.WriteField("ThreeDSessionId", "")
_ = writer.WriteField("CallbackUrl", "https://www.google.com")
_ = writer.WriteField("LanguageCode", "TR")
_ = writer.WriteField("ClientIpAddress", "192.1.1.1")
_ = writer.WriteField("PublicKey", "SkDP+k0jpMPDOzjcQ2dTcg==")
_ = writer.WriteField("Nonce", "")
_ = writer.WriteField("Signature", "")
_ = writer.WriteField("ConversationId", "test123456")
_ = writer.WriteField("MerchantNumber", "1100000001")
err := writer.Close()
if err != nil {
fmt.Println(err)
return
}
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
import requests
url = "https://testpfapi.rubikpara.com/v1/threeds/init3ds"
payload = {'ThreeDSessionId': '',
'CallbackUrl': 'https://www.google.com',
'LanguageCode': 'TR',
'ClientIpAddress': '192.1.1.1',
'PublicKey': 'SkDP+k0jpMPDOzjcQ2dTcg==',
'Nonce': '',
'Signature': '',
'ConversationId': 'test123456',
'MerchantNumber': '1100000001'}
files=[
]
headers = {}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
curl --location 'https://testpfapi.rubikpara.com/v1/threeds/init3ds' --form 'ThreeDSessionId=""' --form 'CallbackUrl="https://www.google.com"' --form 'LanguageCode="TR"' --form 'ClientIpAddress="192.1.1.1"' --form 'PublicKey="SkDP+k0jpMPDOzjcQ2dTcg=="' --form 'Nonce=""' --form 'Signature=""' --form 'ConversationId="test123456"' --form 'MerchantNumber="1100000001"'