Server-to-Server Integration
Use this method if you want to manage the entire payment process from your own server. You create your own payment form and send card details directly to the API.
This method requires card details to pass through your server. If you don't have PCI DSS Level 1 certification, do not use this method. Instead, prefer Hosted Checkout or Embedded Checkout methods.
Who Is This Method For?
- Businesses with PCI DSS certification
- Those who want to design the payment form entirely themselves
- Teams with advanced software development knowledge
General Flow
Step 1: Create a Session
To accept a payment, you first need to create a checkout session. This is how you tell Paylox "prepare a payment for this amount".
Python
import requests
session_resp = requests.post(
"https://api.jetcheckout.com/api/v1/embedded/session",
json={
"merchant_api_key": "ENTER_YOUR_API_KEY_HERE",
"amount": 15000,
"currency": "TRY",
"customer": {
"name": "Ayse",
"surname": "Demir",
"email": "[email protected]",
"phone": "+905551234567",
},
"success_url": "https://yoursite.com/payment/success",
"fail_url": "https://yoursite.com/payment/fail",
}
)
session = session_resp.json()
session_id = session["session_id"]
print(f"Session created: {session_id}")
Node.js
const response = await fetch("https://api.jetcheckout.com/api/v1/embedded/session", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
merchant_api_key: "ENTER_YOUR_API_KEY_HERE",
amount: 15000,
currency: "TRY",
customer: { name: "Ayse", surname: "Demir", email: "[email protected]" },
success_url: "https://yoursite.com/payment/success",
fail_url: "https://yoursite.com/payment/fail"
})
});
const session = await response.json();
const sessionId = session.session_id;
Step 2: Make the Payment
After creating the session, send a payment request with the customer's card details.
Python
payment_resp = requests.post(
"https://api.jetcheckout.com/api/v1/payment/pay",
json={
"session_id": session_id,
"payment_type": "creditcard",
"card_holder_name": "AYSE DEMIR",
"card_number": "5388880000000055",
"expire_month": "12",
"expire_year": "2030",
"cvc": "000",
"is_3d": True,
"installment_count": "1",
}
)
result = payment_resp.json()
if result.get("redirect_url"):
print(f"3D Secure redirect: {result['redirect_url']}")
elif result.get("success"):
print(f"Payment successful! Order No: {result['order_id']}")
Node.js
const paymentResp = await fetch("https://api.jetcheckout.com/api/v1/payment/pay", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
session_id: sessionId,
payment_type: "creditcard",
card_holder_name: "AYSE DEMIR",
card_number: "5388880000000055",
expire_month: "12",
expire_year: "2030",
cvc: "000",
is_3d: true,
installment_count: "1"
})
});
const result = await paymentResp.json();
if (result.redirect_url) {
res.redirect(result.redirect_url);
} else if (result.success) {
console.log("Payment successful! Order No:", result.order_id);
}
Most banks require 3D Secure verification for security reasons. In this case, the API response returns a redirect_url. You need to redirect the customer to this address. After verification, the customer returns to your success_url or fail_url.
Step 3: Verify the Payment Status
After the payment is completed (especially after the 3D Secure flow), you must verify that the payment was actually successful.
Python
status_resp = requests.get(
f"https://api.jetcheckout.com/api/v1/payment/status/{result['order_id']}",
params={"session_id": session_id}
)
status = status_resp.json()
if status["success"] and status["status"] == "completed":
print("Payment verified and successful!")
else:
print("Payment failed or could not be verified.")
Live Demo
Visit the Playground page to test this integration method in sandbox mode.