Skip to content

Start payment

POST
/api/payments/orders/{id}/session
curl --request POST \
--url https://api.petanqueai.com/api/payments/orders/example/session \
--header 'Content-Type: application/json' \
--header 'x-storefront-token: <x-storefront-token>' \
--data '{ "buyer": { "name": "example", "surname": "example", "identityNumber": "example", "email": "hello@example.com", "gsmNumber": "example", "registrationAddress": "example", "city": "example", "country": "example", "zipCode": "example" }, "shippingAddress": { "contactName": "example", "address": "example", "city": "example", "country": "example", "zipCode": "example" }, "billingAddress": { "contactName": "example", "address": "example", "city": "example", "country": "example", "zipCode": "example" }, "returnUrl": "example" }'

Opens an iyzico payment form for an order that is AWAITING_PAYMENT. The amount always comes from the order. Show the form by embedding checkoutFormContent (base64 HTML) or by redirecting to paymentPageUrl; the session expires after about 30 minutes.

After payment iyzico returns the shopper to your returnUrl with ?orderId=… appended. Its origin must be on your allowed origins. The URL carries no result: read it with Get payment status.

Calling this again opens a fresh session, which is how a declined card is retried. 409 if the order is already paid; 422 if iyzico refuses, with its reason in the message.

id
required
string
>= 1 characters
object
buyer
required
object
name
required
string
>= 1 characters <= 100 characters
surname
required
string
>= 1 characters <= 100 characters
identityNumber
required
string
>= 5 characters <= 30 characters
email
required
string format: email
<= 200 characters
gsmNumber
required
string
>= 7 characters <= 30 characters
registrationAddress
required
string
>= 10 characters <= 400 characters
city
required
string
>= 2 characters <= 60 characters
country
string
>= 2 characters <= 60 characters
zipCode
string
<= 20 characters
shippingAddress
required
object
contactName
required
string
>= 1 characters <= 100 characters
address
required
string
>= 10 characters <= 400 characters
city
required
string
>= 2 characters <= 60 characters
country
string
>= 2 characters <= 60 characters
zipCode
string
<= 20 characters
billingAddress
object
contactName
required
string
>= 1 characters <= 100 characters
address
required
string
>= 10 characters <= 400 characters
city
required
string
>= 2 characters <= 60 characters
country
string
>= 2 characters <= 60 characters
zipCode
string
<= 20 characters
returnUrl
string
>= 8 characters <= 500 characters

Example generated

{
"buyer": {
"name": "example",
"surname": "example",
"identityNumber": "example",
"email": "hello@example.com",
"gsmNumber": "example",
"registrationAddress": "example",
"city": "example",
"country": "example",
"zipCode": "example"
},
"shippingAddress": {
"contactName": "example",
"address": "example",
"city": "example",
"country": "example",
"zipCode": "example"
},
"billingAddress": {
"contactName": "example",
"address": "example",
"city": "example",
"country": "example",
"zipCode": "example"
},
"returnUrl": "example"
}