Checkout
Initialize subscriptions, update cards, and handle the payment callback.
POST /checkout/initialize
Initialize a checkout session for customer subscription. Creates checkout session and customer records in database.
Base URL
https://cadence-api.pleasurebyplease.com
Request
POST https://cadence-api.pleasurebyplease.com/checkout/initialize
Headers
X-Api-Key: {your-api-key}X-Api-Secret: {your-api-secret}
Checkout Flow
- Call this endpoint with customer data
- Render the returned
checkoutFormContentHTML in your page - Customer completes payment on iyzico form
- iyzico redirects to your
callbackUrl
Request Body
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
pricingPlanReferenceCode | string | No | Reference code of the pricing plan. Required if segno-plan-id is not provided (mutually exclusive) | plan_abc123 |
segno-plan-id | string | No | Internal Cadence plan ID. Required if pricingPlanReferenceCode is not provided (mutually exclusive) | plan_id_8r2n3k1p |
callbackUrl | string | Yes | URL where iyzico redirects after payment | https://cadence-api.pleasurebyplease.com/checkout/callback |
name | string | Yes | Customer first name | John |
surname | string | Yes | Customer last name | Doe |
email | string | Yes | Customer email address | john@example.com |
gsmNumber | string | Yes | Phone number (E.164 format preferred) | +905551234567 |
identityNumber | string | Yes | Turkish ID number (11 digits) | 12345678901 |
subscriptionInitialStatus | string ("ACTIVE" | "PENDING") | No | Initial status of subscription | |
billingAddress | object | No | Billing address object | |
billingAddress.contactName | string | Yes | Contact name for billing | |
billingAddress.country | string | Yes | Country | |
billingAddress.city | string | Yes | City | |
billingAddress.address | string | Yes | Street address | |
billingAddress.zipCode | string | No | Postal code | |
shippingAddress | object | No | Shipping address (same structure as billingAddress) |
Response (Success)
| Field | Type | Description |
|---|---|---|
status | "success" | Operation result |
checkoutFormContent | string | HTML/JS content to render checkout form |
token | string | Checkout session token |
tokenExpireTime | number | Token validity in seconds |
paymentPageUrl | string | URL to redirect user for payment (alternative to rendering checkoutFormContent) |
clientReferenceId | string | Your tracking ID for this session |
segnoPlanId | string | null | Internal Cadence plan identifier for the selected plan |
Example Request
cURL
curl -X POST \
"https://cadence-api.pleasurebyplease.com/checkout/initialize" \
-H "X-Api-Key: {your-api-key}" \
-H "X-Api-Secret: {your-api-secret}" \
-H "Content-Type: application/json" \
-d '{
"pricingPlanReferenceCode": "plan_abc123",
"callbackUrl": "https://cadence-api.pleasurebyplease.com/checkout/callback",
"name": "John",
"surname": "Doe",
"email": "john@example.com",
"gsmNumber": "+905551234567",
"identityNumber": "12345678901"
}'TypeScript
const response = await fetch('https://cadence-api.pleasurebyplease.com/checkout/initialize', {
method: 'POST',
headers: {
'X-Api-Key': '{your-api-key}',
'X-Api-Secret': '{your-api-secret}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
pricingPlanReferenceCode: 'plan_abc123',
callbackUrl: 'https://cadence-api.pleasurebyplease.com/checkout/callback',
name: 'John',
surname: 'Doe',
email: 'john@example.com',
gsmNumber: '+905551234567',
identityNumber: '12345678901',
}),
});
const data: CheckoutInitializeResponse = await response.json();
if (data.status === 'success' && data.checkoutFormContent) {
// Render the checkout form in your page
document.getElementById('checkout')!.innerHTML = data.checkoutFormContent;
}Node.js
const response = await fetch('https://cadence-api.pleasurebyplease.com/checkout/initialize', {
method: 'POST',
headers: {
'X-Api-Key': '{your-api-key}',
'X-Api-Secret': '{your-api-secret}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
pricingPlanReferenceCode: 'plan_abc123',
callbackUrl: 'https://cadence-api.pleasurebyplease.com/checkout/callback',
name: 'John',
surname: 'Doe',
email: 'john@example.com',
gsmNumber: '+905551234567',
identityNumber: '12345678901',
}),
});
const data = await response.json();
console.log(data);PHP
<?php
$data = [
'pricingPlanReferenceCode' => 'plan_abc123',
'callbackUrl' => 'https://cadence-api.pleasurebyplease.com/checkout/callback',
'name' => 'John',
'surname' => 'Doe',
'email' => 'john@example.com',
'gsmNumber' => '+905551234567',
'identityNumber' => '12345678901'
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://cadence-api.pleasurebyplease.com/checkout/initialize',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'X-Api-Key: {your-api-key}',
'X-Api-Secret: {your-api-secret}',
'Content-Type: application/json'
]
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['status'] === 'success') {
echo $result['checkoutFormContent'];
}Go
package main
import (
"bytes"
"encoding/json"
"net/http"
)
type CheckoutRequest struct {
PricingPlanReferenceCode string `json:"pricingPlanReferenceCode"`
CallbackUrl string `json:"callbackUrl"`
Name string `json:"name"`
Surname string `json:"surname"`
Email string `json:"email"`
GsmNumber string `json:"gsmNumber"`
IdentityNumber string `json:"identityNumber"`
}
func main() {
data := CheckoutRequest{
PricingPlanReferenceCode: "plan_abc123",
CallbackUrl: "https://cadence-api.pleasurebyplease.com/checkout/callback",
Name: "John",
Surname: "Doe",
Email: "john@example.com",
GsmNumber: "+905551234567",
IdentityNumber: "12345678901",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST",
"https://cadence-api.pleasurebyplease.com/checkout/initialize",
bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", "{your-api-key}")
req.Header.Set("X-Api-Secret", "{your-api-secret}")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Ruby
require 'net/http'
require 'json'
uri = URI('https://cadence-api.pleasurebyplease.com/checkout/initialize')
request = Net::HTTP::Post.new(uri)
request['X-Api-Key'] = '{your-api-key}'
request['X-Api-Secret'] = '{your-api-secret}'
request['Content-Type'] = 'application/json'
request.body = {
pricingPlanReferenceCode: 'plan_abc123',
callbackUrl: 'https://cadence-api.pleasurebyplease.com/checkout/callback',
name: 'John',
surname: 'Doe',
email: 'john@example.com',
gsmNumber: '+905551234567',
identityNumber: '12345678901'
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
result = JSON.parse(response.body)
puts result['checkoutFormContent'] if result['status'] == 'success'Python
import requests
response = requests.post(
'https://cadence-api.pleasurebyplease.com/checkout/initialize',
headers={
'X-Api-Key': '{your-api-key}',
'X-Api-Secret': '{your-api-secret}',
'Content-Type': 'application/json'
},
json={
'pricingPlanReferenceCode': 'plan_abc123',
'callbackUrl': 'https://cadence-api.pleasurebyplease.com/checkout/callback',
'name': 'John',
'surname': 'Doe',
'email': 'john@example.com',
'gsmNumber': '+905551234567',
'identityNumber': '12345678901'
}
)
data = response.json()
if data['status'] == 'success':
print(data['checkoutFormContent'])Example Response
{
"status": "success",
"checkoutFormContent": "<script>...</script>",
"token": "checkout_token_xyz",
"tokenExpireTime": 1800,
"paymentPageUrl": "https://sandbox-merchant.iyzipay.com/checkout/test/...",
"clientReferenceId": "550e8400-e29b-41d4-a716-446655440000",
"segnoPlanId": "plan_id_8r2n3k1p"
}POST /checkout/initialize-direct
Initialize a subscription directly with credit card information (Non-3DS). Creates subscription immediately.
Base URL
https://cadence-api.pleasurebyplease.com
Request
POST https://cadence-api.pleasurebyplease.com/checkout/initialize-direct
Headers
X-Api-Key: {your-api-key}X-Api-Secret: {your-api-secret}
Flow
- Collect card information securely
- Call this endpoint
- Subscription is created immediately if successful
Request Body
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
pricingPlanReferenceCode | string | No | Reference code of the pricing plan. Required if segno-plan-id is not provided (mutually exclusive) | plan_abc123 |
segno-plan-id | string | No | Internal Cadence plan ID. Required if pricingPlanReferenceCode is not provided (mutually exclusive) | plan_id_8r2n3k1p |
name | string | Yes | Customer first name | John |
surname | string | Yes | Customer last name | Doe |
email | string | Yes | Customer email address | john@example.com |
gsmNumber | string | Yes | Phone number (E.164 format preferred) | +905551234567 |
identityNumber | string | Yes | Turkish ID number (11 digits) | 12345678901 |
paymentCard | object | Yes | Credit Card Information | |
paymentCard.cardHolderName | string | Yes | Name on the card | John Doe |
paymentCard.cardNumber | string | Yes | Card number | 5528790000000008 |
paymentCard.expireMonth | string | Yes | Expiration month (2 digits) | 12 |
paymentCard.expireYear | string | Yes | Expiration year (4 digits) | 2030 |
paymentCard.cvc | string | Yes | Card CVC/CVV | 123 |
subscriptionInitialStatus | string ("ACTIVE" | "PENDING") | No | Initial status of subscription (default: ACTIVE if successful) | |
billingAddress | object | No | Billing address object | |
shippingAddress | object | No | Shipping address object | |
clientReferenceId | string | No | Your unique reference ID for tracking | order_12345 |
Response (Success)
| Field | Type | Description |
|---|---|---|
status | "success" | Operation result |
segnoSubscriptionId | string | Internal Cadence subscription identifier |
segnoCustomerId | string | null | Internal Cadence customer identifier |
segnoPlanId | string | null | Internal Cadence plan identifier |
data | object | Iyzico response data (referenceCode, customerReferenceCode, subscriptionStatus, etc.) |
Example Request
cURL
curl -X POST \
"https://cadence-api.pleasurebyplease.com/checkout/initialize-direct" \
-H "X-Api-Key: {your-api-key}" \
-H "X-Api-Secret: {your-api-secret}" \
-H "Content-Type: application/json" \
-d '{
"pricingPlanReferenceCode": "plan_abc123",
"clientReferenceId": "order_12345",
"name": "John",
"surname": "Doe",
"email": "john@example.com",
"gsmNumber": "+905551234567",
"identityNumber": "12345678901",
"paymentCard": {
"cardHolderName": "John Doe",
"cardNumber": "5528790000000008",
"expireMonth": "12",
"expireYear": "2030",
"cvc": "123"
}
}'TypeScript
const response = await fetch('https://cadence-api.pleasurebyplease.com/checkout/initialize-direct', {
method: 'POST',
headers: {
'X-Api-Key': '{your-api-key}',
'X-Api-Secret': '{your-api-secret}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
pricingPlanReferenceCode: 'plan_abc123',
clientReferenceId: 'order_12345',
name: 'John',
surname: 'Doe',
email: 'john@example.com',
gsmNumber: '+905551234567',
identityNumber: '12345678901',
paymentCard: {
cardHolderName: 'John Doe',
cardNumber: '5528790000000008',
expireMonth: '12',
expireYear: '2030',
cvc: '123'
},
billingAddress: {
contactName: 'John Doe',
country: 'Turkey',
city: 'Istanbul',
address: 'Example Address 123'
}
}),
});
const data = await response.json();
if (data.status === 'success') {
console.log('Cadence subscription ID:', data.segnoSubscriptionId);
console.log('Iyzico ref:', data.data?.referenceCode);
} else {
console.error('Failed:', data.message);
}Node.js
// Using node-fetch or native fetch (Node 18+)
const response = await fetch('https://cadence-api.pleasurebyplease.com/checkout/initialize-direct', {
method: 'POST',
headers: {
'X-Api-Key': '{your-api-key}',
'X-Api-Secret': '{your-api-secret}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
pricingPlanReferenceCode: 'plan_abc123',
clientReferenceId: 'order_12345',
name: 'John',
surname: 'Doe',
email: 'john@example.com',
gsmNumber: '+905551234567',
identityNumber: '12345678901',
paymentCard: {
cardHolderName: 'John Doe',
cardNumber: '5528790000000008',
expireMonth: '12',
expireYear: '2030',
cvc: '123'
}
}),
});
const data = await response.json();
console.log(data);PHP
<?php
$data = [
'pricingPlanReferenceCode' => 'plan_abc123',
'clientReferenceId' => 'order_12345',
'name' => 'John',
'surname' => 'Doe',
'email' => 'john@example.com',
'gsmNumber' => '+905551234567',
'identityNumber' => '12345678901',
'paymentCard' => [
'cardHolderName' => 'John Doe',
'cardNumber' => '5528790000000008',
'expireMonth' => '12',
'expireYear' => '2030',
'cvc' => '123'
]
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://cadence-api.pleasurebyplease.com/checkout/initialize-direct',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'X-Api-Key: {your-api-key}',
'X-Api-Secret: {your-api-secret}',
'Content-Type: application/json'
]
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
type PaymentCard struct {
CardHolderName string `json:"cardHolderName"`
CardNumber string `json:"cardNumber"`
ExpireMonth string `json:"expireMonth"`
ExpireYear string `json:"expireYear"`
Cvc string `json:"cvc"`
}
type SubscriptionRequest struct {
PricingPlanReferenceCode string `json:"pricingPlanReferenceCode"`
ClientReferenceId string `json:"clientReferenceId"`
Name string `json:"name"`
Surname string `json:"surname"`
Email string `json:"email"`
GsmNumber string `json:"gsmNumber"`
IdentityNumber string `json:"identityNumber"`
PaymentCard PaymentCard `json:"paymentCard"`
}
func main() {
data := SubscriptionRequest{
PricingPlanReferenceCode: "plan_abc123",
ClientReferenceId: "order_12345",
Name: "John",
Surname: "Doe",
Email: "john@example.com",
GsmNumber: "+905551234567",
IdentityNumber: "12345678901",
PaymentCard: PaymentCard{
CardHolderName: "John Doe",
CardNumber: "5528790000000008",
ExpireMonth: "12",
ExpireYear: "2030",
Cvc: "123",
},
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST",
"https://cadence-api.pleasurebyplease.com/checkout/initialize-direct",
bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", "{your-api-key}")
req.Header.Set("X-Api-Secret", "{your-api-secret}")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
// Read and print response body...
}Ruby
require 'net/http'
require 'json'
uri = URI('https://cadence-api.pleasurebyplease.com/checkout/initialize-direct')
request = Net::HTTP::Post.new(uri)
request['X-Api-Key'] = '{your-api-key}'
request['X-Api-Secret'] = '{your-api-secret}'
request['Content-Type'] = 'application/json'
data = {
pricingPlanReferenceCode: 'plan_abc123',
clientReferenceId: 'order_12345',
name: 'John',
surname: 'Doe',
email: 'john@example.com',
gsmNumber: '+905551234567',
identityNumber: '12345678901',
paymentCard: {
cardHolderName: 'John Doe',
cardNumber: '5528790000000008',
expireMonth: '12',
expireYear: '2030',
cvc: '123'
}
}
request.body = data.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.bodyPython
import requests
response = requests.post(
'https://cadence-api.pleasurebyplease.com/checkout/initialize-direct',
headers={
'X-Api-Key': '{your-api-key}',
'X-Api-Secret': '{your-api-secret}',
'Content-Type': 'application/json'
},
json={
'pricingPlanReferenceCode': 'plan_abc123',
'clientReferenceId': 'order_12345',
'name': 'John',
'surname': 'Doe',
'email': 'john@example.com',
'gsmNumber': '+905551234567',
'identityNumber': '12345678901',
'paymentCard': {
'cardHolderName': 'John Doe',
'cardNumber': '5528790000000008',
'expireMonth': '12',
'expireYear': '2030',
'cvc': '123'
}
}
)
print(response.json())Example Response
{
"status": "success",
"segnoSubscriptionId": "sub_id_5x4n2v8k",
"segnoCustomerId": "cust_id_3m7k9p2q",
"segnoPlanId": "plan_id_8r2n3k1p",
"data": {
"referenceCode": "b7879942-5645-42df-b695-94943725b820",
"parentReferenceCode": "b7879942-5645-42df-b695-94943725b820",
"pricingPlanReferenceCode": "plan_abc123",
"customerReferenceCode": "cust_12345",
"subscriptionStatus": "ACTIVE",
"createdDate": 1738075594000,
"startDate": 1738075594000,
"endDate": null
}
}POST /checkout/update-card
Initialize a checkout form session to update a subscriber's credit card.
Base URL
https://cadence-api.pleasurebyplease.com
Request
POST https://cadence-api.pleasurebyplease.com/checkout/update-card
Headers
X-Api-Key: {your-api-key}X-Api-Secret: {your-api-secret}
Flow
- Call this endpoint to get form content
- Render form on your frontend
- User enters new card details
- Redirects to callback URL upon completion
Request Body
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
callbackUrl | string | Yes | URL where iyzico redirects after operation | https://cadence-api.pleasurebyplease.com/checkout/callback |
subscriptionReferenceCode | string | No | Reference code of the subscription. Required if segno-id is not provided; use with customerReferenceCode (mutually exclusive with segno-id) | b7879942-5645-42df-b695-94943725b820 |
customerReferenceCode | string | No | Reference code of the customer. Required if segno-id is not provided; use with subscriptionReferenceCode (mutually exclusive with segno-id) | cust_12345 |
segno-id | string | No | Internal Cadence subscription ID. Required if subscriptionReferenceCode/customerReferenceCode are not provided (mutually exclusive) | sub_id_5x4n2v8k |
clientReferenceId | string | No | Your unique reference ID for tracking | req_12345 |
Response (Success)
| Field | Type | Description |
|---|---|---|
status | "success" | Operation result |
token | string | Checkout session token |
checkoutFormContent | string | HTML/JS content to render checkout form |
tokenExpireTime | number | Token validity in seconds |
paymentPageUrl | string | URL to redirect user for card update |
segnoId | string | null | Internal Cadence subscription identifier |
Example Request
cURL
curl -X POST \
"https://cadence-api.pleasurebyplease.com/checkout/update-card" \
-H "X-Api-Key: {your-api-key}" \
-H "X-Api-Secret: {your-api-secret}" \
-H "Content-Type: application/json" \
-d '{
"callbackUrl": "https://cadence-api.pleasurebyplease.com/checkout/callback",
"subscriptionReferenceCode": "b7879942-5645-42df-b695-94943725b820",
"customerReferenceCode": "cust_12345",
"clientReferenceId": "req_12345"
}'TypeScript
const response = await fetch('https://cadence-api.pleasurebyplease.com/checkout/update-card', {
method: 'POST',
headers: {
'X-Api-Key': '{your-api-key}',
'X-Api-Secret': '{your-api-secret}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
callbackUrl: 'https://cadence-api.pleasurebyplease.com/checkout/callback',
subscriptionReferenceCode: 'b7879942-5645-42df-b695-94943725b820',
customerReferenceCode: 'cust_12345',
clientReferenceId: 'req_12345'
}),
});
const data = await response.json();
if (data.status === 'success' && data.checkoutFormContent) {
// Render form, or redirect to data.paymentPageUrl
document.getElementById('checkout-container').innerHTML = data.checkoutFormContent;
}Node.js
const response = await fetch('https://cadence-api.pleasurebyplease.com/checkout/update-card', {
method: 'POST',
headers: {
'X-Api-Key': '{your-api-key}',
'X-Api-Secret': '{your-api-secret}',
'Content-Type': 'application/json',
},
body: JSON.stringify({
callbackUrl: 'https://cadence-api.pleasurebyplease.com/checkout/callback',
subscriptionReferenceCode: 'b7879942-5645-42df-b695-94943725b820',
customerReferenceCode: 'cust_12345',
clientReferenceId: 'req_12345'
}),
});
const data = await response.json();
console.log(data);PHP
<?php
$data = [
'callbackUrl' => 'https://cadence-api.pleasurebyplease.com/checkout/callback',
'subscriptionReferenceCode' => 'b7879942-5645-42df-b695-94943725b820',
'customerReferenceCode' => 'cust_12345',
'clientReferenceId' => 'req_12345'
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://cadence-api.pleasurebyplease.com/checkout/update-card',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
'X-Api-Key: {your-api-key}',
'X-Api-Secret: {your-api-secret}',
'Content-Type: application/json'
]
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);Go
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
values := map[string]string{
"callbackUrl": "https://cadence-api.pleasurebyplease.com/checkout/callback",
"subscriptionReferenceCode": "b7879942-5645-42df-b695-94943725b820",
"customerReferenceCode": "cust_12345",
"clientReferenceId": "req_12345",
}
jsonData, _ := json.Marshal(values)
req, _ := http.NewRequest("POST",
"https://cadence-api.pleasurebyplease.com/checkout/update-card",
bytes.NewBuffer(jsonData))
req.Header.Set("X-Api-Key", "{your-api-key}")
req.Header.Set("X-Api-Secret", "{your-api-secret}")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Ruby
require 'net/http'
require 'json'
uri = URI('https://cadence-api.pleasurebyplease.com/checkout/update-card')
req = Net::HTTP::Post.new(uri)
req['X-Api-Key'] = '{your-api-key}'
req['X-Api-Secret'] = '{your-api-secret}'
req['Content-Type'] = 'application/json'
req.body = {
callbackUrl: 'https://cadence-api.pleasurebyplease.com/checkout/callback',
subscriptionReferenceCode: 'b7879942-5645-42df-b695-94943725b820',
customerReferenceCode: 'cust_12345',
clientReferenceId: 'req_12345'
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(req)
end
puts res.bodyPython
import requests
response = requests.post(
'https://cadence-api.pleasurebyplease.com/checkout/update-card',
headers={
'X-Api-Key': '{your-api-key}',
'X-Api-Secret': '{your-api-secret}',
'Content-Type': 'application/json'
},
json={
'callbackUrl': 'https://cadence-api.pleasurebyplease.com/checkout/callback',
'subscriptionReferenceCode': 'b7879942-5645-42df-b695-94943725b820',
'customerReferenceCode': 'cust_12345',
'clientReferenceId': 'req_12345'
}
)
print(response.json())Example Response
{
"status": "success",
"token": "token_xyz123",
"checkoutFormContent": "<script>...</script>",
"tokenExpireTime": 1800,
"paymentPageUrl": "https://sandbox-merchant.iyzipay.com/checkout/test/...",
"segnoId": "sub_id_5x4n2v8k"
}GET /checkout/callback
Callback endpoint that iyzico redirects to after payment. Activates the subscription with iyzico and redirects to your callbackUrl with the result.
Base URL
https://cadence-api.pleasurebyplease.com
Request
GET https://cadence-api.pleasurebyplease.com/checkout/callback
Headers
X-Api-Key: {your-api-key}X-Api-Secret: {your-api-secret}
How It Works
- iyzico redirects customer to this endpoint with a token
- We retrieve the checkout result from iyzico
- If successful, we activate the subscription with iyzico
- We redirect to YOUR callbackUrl with result data as query params
Query Parameters (from iyzico)
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
token | string | Yes | Checkout token provided by iyzico redirect |
Redirect Query Params (Success)
| Field | Type | Description |
|---|---|---|
status | "success" | Indicates successful checkout |
subscriptionReference | string | Unique reference code for the created subscription (iyzico) |
customerReference | string | Unique reference code for the customer in iyzico |
planReference | string | The pricing plan reference code |
segnoSubscriptionId | string | Internal Cadence subscription identifier |
segnoCustomerId | string | Internal Cadence customer identifier |
Redirect Query Params (Error)
| Field | Type | Description |
|---|---|---|
status | "error" | Indicates failed checkout |
errorCode | string | Error code from iyzico or internal error code |
errorMessage | string | Human-readable error description |
Behavior
On Success:
- Retrieves checkout result from iyzico
- Activates subscription with iyzico (if PENDING)
- Updates checkout session to SUCCESS
- Updates customer record with iyzico reference
- Creates subscription record in database
- Redirects to your callbackUrl with success params
On Failure:
- Updates checkout session to FAILED
- Stores error code and message
- Redirects to your callbackUrl with error params
Example Success Redirect
https://yoursite.com/payment/callback?status=success&subscriptionReference=sub_abc123&customerReference=cust_xyz789&planReference=plan_pro_monthly
Example Error Redirect
https://yoursite.com/payment/callback?status=error&errorCode=PAYMENT_DECLINED&errorMessage=Insufficient%20funds
Handle the Redirect
const url = new URL(window.location.href);
const status = url.searchParams.get('status');
if (status === 'success') {
const subscriptionRef = url.searchParams.get('subscriptionReference');
const segnoSubscriptionId = url.searchParams.get('segnoSubscriptionId');
const segnoCustomerId = url.searchParams.get('segnoCustomerId');
// Show success message, redirect to dashboard, etc.
} else {
const errorCode = url.searchParams.get('errorCode');
const errorMessage = url.searchParams.get('errorMessage');
// Show error message to user
}