2. Non-Secure
Direkt ödeme servisi, istek gönderdiğiniz anda kart bilgilerinden ödemeyi tahsil etme işlemini başlatır ve işlem sonucunu cevap içerisinde döner
POST
{{Base Adres}}/api/paywall/payment/startdirect
Önemli: Ödeme servisini kullanabilmeniz için 'Header' alanında 'apikeypublic' ve 'apiclientpublic' parametrelerini göndermeniz gerekmektedir. PaymentAPI Adresi
Servise gönderilecek örnek JSON ve örnek kodlar aşağıdaki gibidir.
Parametre
Tip
Zorunlu
Açıklama
apikeypublic
string
Evet
Üye işyeri panelinden temin etmiş olduğunuz Public Key.
apiclientpublic
string
Evet
Üye işyeri panelinden temin etmiş olduğunuz Public Client.
PayWall İstek Payload
{
"PaymentDetail": {
"Amount": 1.00,
"MerchantUniqueCode": "22123222256226225",
"Half2D": false,
"ClientIP": "0.0.0.0",
"CurrencyId": 1,
"Installment": 1,
"ChannelId": 0,
"TagId": 0,
"EndOfTheDay": 1,
"RegionId": 1,
"ProviderBased": false,
"ProviderKey": "providerkey",
"MarketPlace": {
"BasketAmount": 1.00
}
},
"Card":{
"OwnerName":"Iyzico Kartı",
"Number":"5528790000000008",
"ExpireMonth":"12",
"ExpireYear":"2030",
"Cvv":"123",
"UniqueCode":"",
"CardSave": {
"Nickname": "Kredi kartım",
"RelationalId1": "userid19283746",
"RelationalId2": "",
"RelationalId3": "",
"Save": true
}
},
"Customer":{
"FullName":"FullName",
"Phone":"5336662211",
"Email":"enes@xcompany.com",
"Country":"Country",
"City":"City",
"Address":"Address",
"IdentityNumber":"IdentityNumber",
"TaxNumber":"TaxNumber"
},
"Products":[{
"ProductId": "ProductId",
"ProductName": "ProductName",
"ProductCategory": "ProductCategory",
"ProductDescription": "ProductDescription",
"ProductAmount": 1.0,
"MemberId": 0,
"DiscountOwnerType": 0,
"DiscountType": 0,
"DiscountValue": 0,
"CargoType": 0,
"CargoCurrencyId": 0,
"CargoCost": 0,
"MemberCustomCommission": false,
"MemberCommission": 0,
"MemberEarningCalculated": false,
"MemberEarning": 0
}]
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class Program
{
static readonly HttpClient client = new HttpClient();
public class PaymentDetail
{
public double Amount { get; set; }
public string MerchantUniqueCode { get; set; }
public int CurrencyId { get; set; }
public string MerchantSuccessBackUrl { get; set; }
public string MerchantFailBackUrl { get; set; }
public int Installement { get; set; }
public int ChannelId { get; set; }
public int TagId { get; set; }
public bool Half3D { get; set; }
}
public class Card
{
public string OwnerName { get; set; }
public string Number { get; set; }
public string ExpireMonth { get; set; }
public string ExpireYear { get; set; }
public string Cvv { get; set; }
public string UniqueCode { get; set; }
}
public class Customer
{
public string FullName { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
public string Country { get; set; }
public string City { get; set; }
public string Address { get; set; }
public string IdentityNumber { get; set; }
public string TaxNumber { get; set; }
}
public class Product
{
public string ProductId { get; set; }
public string ProductName { get; set; }
public string ProductCategory { get; set; }
public string ProductDescription { get; set; }
public double ProductAmount { get; set; }
}
public class Root
{
public PaymentDetail PaymentDetail { get; set; }
public Card Card { get; set; }
public Customer Customer { get; set; }
public Product[] Products { get; set; }
}
public static async Task Main()
{
Root root = new Root
{
PaymentDetail = new PaymentDetail
{
Amount = 9.85,
MerchantUniqueCode = "AJSHFSAKFHASKHFA",
CurrencyId = 1,
MerchantSuccessBackUrl = "https://merchantsite.site.com/success",
MerchantFailBackUrl = "https://merchantsite.site.com/fail",
Installement = 1,
ChannelId = 0,
TagId = 0,
Half3D = false
},
Card = new Card
{
OwnerName = "John Doe",
Number = "5528790000000008",
ExpireMonth = "12",
ExpireYear = "2030",
Cvv = "123",
UniqueCode = ""
},
Customer = new Customer
{
FullName = "FullName",
Phone = "5336662211",
Email = "enes@xcompany.com",
Country = "Country",
City = "City",
Address = "Address",
IdentityNumber = "IdentityNumber",
TaxNumber = "TaxNumber"
},
Products = new Product[] {
new Product {
ProductId = "ProductId",
ProductName = "ProductName",
ProductCategory = "ProductCategory",
ProductDescription = "ProductDescription",
ProductAmount = 9.85
}
}
};
string json = JsonConvert.SerializeObject(root, Formatting.Indented);
var data = new StringContent(json, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("apikeypublic", "%%");
client.DefaultRequestHeaders.Add("apiclientpublic", "%%");
var url = "{{Base Adres}}/api/paywall/payment/startdirect";
var response = await client.PostAsync(url, data);
string result = response.Content.ReadAsStringAsync().Result;
Console.WriteLine(result);
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type PaymentDetail struct {
Amount float64 `json:"Amount"`
MerchantUniqueCode string `json:"MerchantUniqueCode"`
CurrencyId int `json:"CurrencyId"`
MerchantSuccessBackUrl string `json:"MerchantSuccessBackUrl"`
MerchantFailBackUrl string `json:"MerchantFailBackUrl"`
Installement int `json:"Installement"`
ChannelId int `json:"ChannelId"`
TagId int `json:"TagId"`
Half3D bool `json:"Half3D"`
}
type Card struct {
OwnerName string `json:"OwnerName"`
Number string `json:"Number"`
ExpireMonth string `json:"ExpireMonth"`
ExpireYear string `json:"ExpireYear"`
Cvv string `json:"Cvv"`
UniqueCode string `json:"UniqueCode"`
}
type Customer struct {
FullName string `json:"FullName"`
Phone string `json:"Phone"`
Email string `json:"Email"`
Country string `json:"Country"`
City string `json:"City"`
Address string `json:"Address"`
IdentityNumber string `json:"IdentityNumber"`
TaxNumber string `json:"TaxNumber"`
}
type Product struct {
ProductId string `json:"ProductId"`
ProductName string `json:"ProductName"`
ProductCategory string `json:"ProductCategory"`
ProductDescription string `json:"ProductDescription"`
ProductAmount float64 `json:"ProductAmount"`
}
type Data struct {
PaymentDetail PaymentDetail `json:"PaymentDetail"`
Card Card `json:"Card"`
Customer Customer `json:"Customer"`
Products []Product `json:"Products"`
}
type ResponseData struct {
ErrorCode int
Result bool
Message string
Body string
}
func main() {
data := Data{
PaymentDetail: PaymentDetail{
Amount: 9.85,
MerchantUniqueCode: "AJSHFSAKFHASKHFA",
CurrencyId: 1,
MerchantSuccessBackUrl: "https://merchantsite.site.com/success",
MerchantFailBackUrl: "https://merchantsite.site.com/fail",
Installement: 1,
ChannelId: 0,
TagId: 0,
Half3D: false,
},
Card: Card{
OwnerName: "John Doe",
Number: "5528790000000008",
ExpireMonth: "12",
ExpireYear: "2030",
Cvv: "123",
UniqueCode: "",
},
Customer: Customer{
FullName: "FullName",
Phone: "5336662211",
Email: "enes@xcompany.com",
Country: "Country",
City: "City",
Address: "Address",
IdentityNumber: "IdentityNumber",
TaxNumber: "TaxNumber",
},
Products: []Product{
{
ProductId: "ProductId",
ProductName: "ProductName",
ProductCategory: "ProductCategory",
ProductDescription: "ProductDescription",
ProductAmount: 9.85,
},
},
}
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode(data)
req, _ := http.NewRequest("POST", "{{Base Adres}}/api/paywall/payment/startdirect", payloadBuf)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("apikeypublic", "%%")
req.Header.Set("apiclientpublic", "%%")
client := &http.Client{}
res, e := client.Do(req)
if e != nil {
panic(e)
}
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
var responseData ResponseData
json.Unmarshal(body, &responseData)
fmt.Println("ErrorCode: ", responseData.ErrorCode)
fmt.Println("Result: ", responseData.Result)
fmt.Println("Message: ", responseData.Message)
fmt.Println("Body: ", responseData.Body)
}
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.5</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
</dependencies>
import okhttp3.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
ObjectMapper mapper = new ObjectMapper();
// Create JSON in a readable way
ObjectNode rootNode = mapper.createObjectNode();
rootNode.put("Amount", 9.85);
rootNode.put("MerchantUniqueCode", "AJSHFSAKFHASKHFA");
rootNode.put("CurrencyId", 1);
rootNode.put("MerchantSuccessBackUrl", "https://merchantsite.site.com/success");
rootNode.put("MerchantFailBackUrl", "https://merchantsite.site.com/fail");
rootNode.put("Installement", 1);
rootNode.put("ChannelId", 0);
rootNode.put("TagId", 0);
rootNode.put("Half3D", false);
// and so on for all fields
String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(rootNode);
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, json);
Request request = new Request.Builder()
.url("{{Base Adres}}/api/paywall/payment/startdirect")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("apikeypublic", "%%")
.addHeader("apiclientpublic", "%%")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
<?php
$url = '{{Base Adres}}/api/paywall/payment/startdirect';
$data = array(
"PaymentDetail" => array(
"Amount" => 9.85,
"MerchantUniqueCode" => "AJSHFSAKFHASKHFA",
"CurrencyId" => 1,
"MerchantSuccessBackUrl" => "https://merchantsite.site.com/success",
"MerchantFailBackUrl" => "https://merchantsite.site.com/fail",
"Installement" => 1,
"ChannelId" => 0,
"TagId" => 0,
"Half3D" => false
),
"Card" => array(
"OwnerName" => "John Doe",
"Number" => "5528790000000008",
"ExpireMonth" => "12",
"ExpireYear" => "2030",
"Cvv" => "123",
"UniqueCode" => ""
),
"Customer" => array(
"FullName" => "FullName",
"Phone" => "5336662211",
"Email" => "enes@xcompany.com",
"Country" => "Country",
"City" => "City",
"Address" => "Address",
"IdentityNumber" => "IdentityNumber",
"TaxNumber" => "TaxNumber"
),
"Products" => array(
array(
"ProductId" => "ProductId",
"ProductName" => "ProductName",
"ProductCategory" => "ProductCategory",
"ProductDescription" => "ProductDescription",
"ProductAmount" => 9.85
)
)
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n" .
"apikeypublic: %PUBLICKEY%\r\n" .
"apiclientpublic: %PUBLICCLIENT%\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 */ }
// Decode
$response = json_decode($result);
// ErrorCode-Result-Message
echo "ErrorCode: " . $response->ErrorCode . "\n";
echo "Result: " . ($response->Result ? "true" : "false") . "\n";
echo "Message: " . $response->Message . "\n";
// Decode Body
$body = json_decode($response->Body);
var_dump($result);
?>
import requests
import json
url = '{{Base Adres}}/api/paywall/payment/startdirect'
headers = {
'Content-Type': 'application/json',
'apikeypublic': '%%',
'apiclientpublic': '%%'
}
data = {
"PaymentDetail": {
"Amount": 9.85,
"MerchantUniqueCode": "AJSHFSAKFHASKHFA",
"CurrencyId": 1,
"MerchantSuccessBackUrl": "https://merchantsite.site.com/success",
"MerchantFailBackUrl": "https://merchantsite.site.com/fail",
"Installement": 1,
"ChannelId": 0,
"TagId": 0,
"Half3D": False
},
"Card": {
"OwnerName": "John Doe",
"Number": "5528790000000008",
"ExpireMonth": "12",
"ExpireYear": "2030",
"Cvv": "123",
"UniqueCode": ""
},
"Customer": {
"FullName": "FullName",
"Phone": "5336662211",
"Email": "enes@xcompany.com",
"Country": "Country",
"City": "City",
"Address": "Address",
"IdentityNumber": "IdentityNumber",
"TaxNumber": "TaxNumber"
},
"Products": [{
"ProductId": "ProductId",
"ProductName": "ProductName",
"ProductCategory": "ProductCategory",
"ProductDescription": "ProductDescription",
"ProductAmount": 9.85
}]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
response_data = response.json()
print("ErrorCode: ", response_data.get('ErrorCode'))
print("Result: ", response_data.get('Result'))
print("Message: ", response_data.get('Message'))
body = json.loads(response_data.get('Body'))
print(body)
else:
print(f'Request failed with status code {response.status_code}')
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("{{Base Adres}}/api/paywall/payment/startdirect")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path, {
'Content-Type' => 'application/json',
'apikeypublic' => '%%',
'apiclientpublic' => '%%'
})
request.body = JSON.generate({
"PaymentDetail" => {
"Amount" => 9.85,
"MerchantUniqueCode" => "AJSHFSAKFHASKHFA",
"CurrencyId" => 1,
"MerchantSuccessBackUrl" => "https://merchantsite.site.com/success",
"MerchantFailBackUrl" => "https://merchantsite.site.com/fail",
"Installement" => 1,
"ChannelId" => 0,
"TagId" => 0,
"Half3D" => false
},
"Card" => {
"OwnerName" => "John Doe",
"Number" => "5528790000000008",
"ExpireMonth" => "12",
"ExpireYear" => "2030",
"Cvv" => "123",
"UniqueCode" => ""
},
"Customer" => {
"FullName" => "FullName",
"Phone" => "5336662211",
"Email" => "enes@xcompany.com",
"Country" => "Country",
"City" => "City",
"Address" => "Address",
"IdentityNumber" => "IdentityNumber",
"TaxNumber" => "TaxNumber"
},
"Products" => [
{
"ProductId" => "ProductId",
"ProductName" => "ProductName",
"ProductCategory" => "ProductCategory",
"ProductDescription" => "ProductDescription",
"ProductAmount" => 9.85
}
]
})
response = http.request(request)
puts response.body
import axios, { AxiosResponse } from 'axios';
interface ResponseData {
ErrorCode: number;
Result: boolean;
Message: string;
Body: string;
}
let data = {
PaymentDetail: {
Amount: 9.85,
MerchantUniqueCode: "AJSHFSAKFHASKHFA",
CurrencyId: 1,
MerchantSuccessBackUrl: "https://merchantsite.site.com/success",
MerchantFailBackUrl: "https://merchantsite.site.com/fail",
Installement: 1,
ChannelId: 0,
TagId: 0,
Half3D: false
},
Card: {
OwnerName: "John Doe",
Number: "5528790000000008",
ExpireMonth: "12",
ExpireYear: "2030",
Cvv: "123",
UniqueCode: ""
},
Customer: {
FullName: "FullName",
Phone: "5336662211",
Email: "enes@xcompany.com",
Country: "Country",
City: "City",
Address: "Address",
IdentityNumber: "IdentityNumber",
TaxNumber: "TaxNumber"
},
Products: [{
ProductId: "ProductId",
ProductName: "ProductName",
ProductCategory: "ProductCategory",
ProductDescription: "ProductDescription",
ProductAmount: 9.85
}]
};
let config = {
method: 'post',
url: '{{Base Adres}}/api/paywall/payment/startdirect',
headers: {
'Content-Type': 'application/json',
'apikeypublic': '%%',
'apiclientpublic': '%%'
},
data : data
};
axios(config)
.then(function (response: AxiosResponse<ResponseData>) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
curl --location --request POST '{{Base Adres}}/api/paywall/payment/startdirect' \
--header 'Content-Type: application/json' \
--header 'apikeypublic: %%PUBLICKEY%%' \
--header 'apiclientpublic: %%PUBLICCLIENT%%' \
--data-raw '{
"PaymentDetail": {
"Amount": 9.85,
"MerchantUniqueCode": "FASLSZDPOT3535BFNGI",
"CurrencyId": 1,
"MerchantSuccessBackUrl": "https://merchantsite.site.com/success",
"MerchantFailBackUrl": "https://merchantsite.site.com/fail",
"Installement": 1,
"ChannelId": 0,