POST /api/v1/apple-pay/merchant-session-by-account
Request an Apple Pay merchant session using your accountId. No payment intent required.
Use this endpoint for the Encrypted Payloads S2S flow. The origin must match a registered payment page domain.
Pass the returned session object to completeMerchantValidation() in the Apple Pay JS API.
Guide: Apple Pay Guide — conceptual walkthrough, flow diagrams, and integration patterns.
Headers
| Header | Value |
|---|---|
Content-Type | application/json |
Authorization | Bearer {token} — see Authentication |
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
validationUrl | String | Yes | Apple's validation URL provided by the Apple Pay JS API on the client side |
origin | String | Yes | Origin of the page requesting the session (e.g. https://checkout.your-site.com). Must match a registered payment page domain |
accountId | Long | Yes | Merchant account ID used to look up the Apple Pay configuration |
Response
Returns an opaque Apple Pay session object as JSON. Pass it directly to completeMerchantValidation() in the Apple Pay JS API. Do not parse or modify it.
Example Request
{
"validationUrl": "https://apple-pay-gateway.apple.com/paymentservices/startSession",
"origin": "https://checkout.your-site.com",
"accountId": 825952981806376569
}Error Responses
| HTTP Status | Description |
|---|---|
400 | Bad Request — missing or invalid parameters |
401 | Unauthorized — missing, expired, or invalid bearer token |
404 | Not Found — merchant not found for the given accountId |
422 | Unprocessable Entity — Apple Pay is not enabled for the given merchant account |
500 | Internal Server Error — unexpected error, retry with backoff |
Code Examples
cURL
curl -X POST https://sandbox.api.exirom.com/api/v1/apple-pay/merchant-session-by-account \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"validationUrl": "https://apple-pay-gateway.apple.com/paymentservices/startSession",
"origin": "https://checkout.your-site.com",
"accountId": 825952981806376569
}'Python
import requests
url = "https://sandbox.api.exirom.com/api/v1/apple-pay/merchant-session-by-account"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN"
}
payload = {
"validationUrl": "https://apple-pay-gateway.apple.com/paymentservices/startSession",
"origin": "https://checkout.your-site.com",
"accountId": 825952981806376569
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Node.js
const response = await fetch("https://sandbox.api.exirom.com/api/v1/apple-pay/merchant-session-by-account", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN",
},
body: JSON.stringify({
validationUrl: "https://apple-pay-gateway.apple.com/paymentservices/startSession",
origin: "https://checkout.your-site.com",
accountId: 825952981806376569
}),
});
const data = await response.json();
console.log(data);Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]interface{}{
"validationUrl": "https://apple-pay-gateway.apple.com/paymentservices/startSession",
"origin": "https://checkout.your-site.com",
"accountId": 825952981806376569,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://sandbox.api.exirom.com/api/v1/apple-pay/merchant-session-by-account", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(respBody))
}Kotlin
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
fun main() {
val client = OkHttpClient()
val json = """
{
"validationUrl": "https://apple-pay-gateway.apple.com/paymentservices/startSession",
"origin": "https://checkout.your-site.com",
"accountId": 825952981806376569
}
""".trimIndent()
val body = json.toRequestBody("application/json".toMediaType())
val request = Request.Builder()
.url("https://sandbox.api.exirom.com/api/v1/apple-pay/merchant-session-by-account")
.post(body)
.addHeader("Authorization", "Bearer YOUR_TOKEN")
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
