Start payment
POST
/api/payments/orders/{id}/session
const url = 'https://api.petanqueai.com/api/payments/orders/example/session';const options = { method: 'POST', headers: { 'x-storefront-token': '<x-storefront-token>', 'Content-Type': 'application/json' }, body: '{"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"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”object
buyer
required
object
name
required
string
surname
required
string
identityNumber
required
string
email
required
string format: email
gsmNumber
required
string
registrationAddress
required
string
city
required
string
country
string
zipCode
string
shippingAddress
required
object
contactName
required
string
address
required
string
city
required
string
country
string
zipCode
string
billingAddress
object
contactName
required
string
address
required
string
city
required
string
country
string
zipCode
string
returnUrl
string
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"}object
buyer
required
object
name
required
string
surname
required
string
identityNumber
required
string
email
required
string format: email
gsmNumber
required
string
registrationAddress
required
string
city
required
string
country
string
zipCode
string
shippingAddress
required
object
contactName
required
string
address
required
string
city
required
string
country
string
zipCode
string
billingAddress
object
contactName
required
string
address
required
string
city
required
string
country
string
zipCode
string
returnUrl
string
Example generated
name=example&surname=example&identityNumber=example&email=hello%40example.com&gsmNumber=example®istrationAddress=example&city=example&country=example&zipCode=example&contactName=example&address=example&city=example&country=example&zipCode=example&contactName=example&address=example&city=example&country=example&zipCode=example&returnUrl=exampleobject
buyer
required
object
name
required
string
surname
required
string
identityNumber
required
string
email
required
string format: email
gsmNumber
required
string
registrationAddress
required
string
city
required
string
country
string
zipCode
string
shippingAddress
required
object
contactName
required
string
address
required
string
city
required
string
country
string
zipCode
string
billingAddress
object
contactName
required
string
address
required
string
city
required
string
country
string
zipCode
string
returnUrl
string