Encryption and signing
Requests and responses share one shape: a {key, data} body. The only difference from the B2B2C webview is that the content inside data is JSON instead of a |-joined string.
Session key
3DES (DESede), random 24 bytes, one key per request
—
key
RSA/ECB/PKCS1Padding of the session key
Base64 URL-safe, no padding
data
DESede/ECB/PKCS5Padding of the envelope JSON (UTF-8)
Base64 URL-safe, no padding
signature
SHA256withRSA (PKCS#1 v1.5)
Standard Base64
payload hash
SHA-256 of the payload string (UTF-8)
lowercase hex
Request
POST /bsv/api/partner/v1/availability
apikey: <apikey>
Content-Type: application/json
{"key": "<key>", "data": "<data>"}Envelope before being encrypted into data:
{
"accessCode": "PARTNER_ACCESS_CODE",
"timestamp": 1791700000,
"requestId": "6f1c2a7e-0b9d-4b3e-9a51-2f0c3d4e5f60",
"payload": "{\"masterIds\":[\"1001\",\"1002\"],\"checkin\":\"2026-11-20\",\"checkout\":\"2026-11-22\",\"rooms\":[{\"adults\":2,\"childAges\":[]}]}",
"signature": "<signature>"
}accessCode
string
Partner accessCode
timestamp
int64
Epoch seconds. More than 300 seconds off is rejected (26)
requestId
string ≤ 64
Not reused within 10 minutes; UUID recommended
payload
string
A string holding the API JSON, not an object
signature
string
Signed over accessCode|timestamp|requestId|sha256hex(payload)
Steps to build a request:
Build
payload= the API JSON, as a string.Compute
sha256hex(payload), assemble the signing string, sign it with the partner private key to getsignature.Assemble the envelope JSON, generate a random 3DES key, encrypt the envelope to get
data.Encrypt the 3DES key with the Gotadi public key to get
key.Send
{key, data}with theapikeyheader.
Response
HTTP 200, body {key, data}. key is decrypted with the partner private key to recover the 3DES key; data decrypts to the envelope:
Verify signature with the Gotadi public key over accessCode|timestamp|requestId|code|sha256hex(payload), check accessCode matches gotadiAccessCode and requestId matches the request sent — only then trust code and payload. On error, payload is "{}", except code 20 PRICE_CHANGED, which carries the new price and bookingToken.
requestId and idempotency
One new
requestIdper request.Only the 4 write APIs —
price-check,bookings/create,bookings/commit,bookings/cancel— rememberrequestIdfor 10 minutes:same
requestId+ samepayload→ the original response is returned, nothing is processed twice;same
requestId+ differentpayload→27 DUPLICATED_REQUEST_ID;first call still running →
01 ON_PROCESS.
When retrying after a timeout, keep the same
requestId, change onlytimestampand re-sign.Read APIs do not store
requestId;availabilitypolling uses a new one each round.
Cập nhật lần cuối