using RestSharp;
var options = new RestClientOptions("https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"payload\": {\n \"key\": \"value\"\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session"
payload := strings.NewReader("{\n \"payload\": {\n \"key\": \"value\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"key\": \"value\"\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
'key' => 'value'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session"
payload = { "payload": { "key": "value" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({payload: {key: 'value'}})
};
fetch('https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payload": {
"key": "value"
}
}
'{
"session_data": {
"key": "value"
},
"default_completion_url": "<string>"
}{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}{
"type": "error",
"code": "forbidden",
"status": 403,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}{
"type": "error",
"code": "method_not_allowed",
"status": 405,
"message": "Method Not Allowed",
"details": []
}{
"type": "error",
"code": "duplicate_record",
"status": 409,
"message": "Generic error",
"details": [],
"resource_id": "cdc70639-cb9c-4222-a73f-b8ce39f7821b"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"type": "error",
"code": "too_early",
"status": 425,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "too_many_requests",
"status": 429,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "server_error",
"status": 500,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "bad_gateway",
"status": 502,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "gateway_timeout",
"status": 504,
"message": "Request could not be processed",
"details": []
}Get or update transaction session
Gets and/or updates a transaction’s session, where the connector supports this feature. Updates are often optional or not supported. Please refer to connector documentation.
using RestSharp;
var options = new RestClientOptions("https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"payload\": {\n \"key\": \"value\"\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session"
payload := strings.NewReader("{\n \"payload\": {\n \"key\": \"value\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"key\": \"value\"\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payload' => [
'key' => 'value'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session"
payload = { "payload": { "key": "value" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({payload: {key: 'value'}})
};
fetch('https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.sandbox.{id}.gr4vy.app/transactions/{transaction_id}/session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payload": {
"key": "value"
}
}
'{
"session_data": {
"key": "value"
},
"default_completion_url": "<string>"
}{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}{
"type": "error",
"code": "forbidden",
"status": 403,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}{
"type": "error",
"code": "method_not_allowed",
"status": 405,
"message": "Method Not Allowed",
"details": []
}{
"type": "error",
"code": "duplicate_record",
"status": 409,
"message": "Generic error",
"details": [],
"resource_id": "cdc70639-cb9c-4222-a73f-b8ce39f7821b"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"type": "error",
"code": "too_early",
"status": 425,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "too_many_requests",
"status": 429,
"message": "Generic error",
"details": []
}{
"type": "error",
"code": "server_error",
"status": 500,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "bad_gateway",
"status": 502,
"message": "Request could not be processed",
"details": []
}{
"type": "error",
"code": "gateway_timeout",
"status": 504,
"message": "Request could not be processed",
"details": []
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the transaction
"7099948d-7286-47e4-aad8-b68f7eb44591"
Query Parameters
Transaction session token used to retrieve session data for direct client integrations.
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
Body
Payload that may be required to update a payment provider's client session, depending on the connector.
{ "key": "value" }
Response
Successful Response
Session data required to launch a payment provider client SDK
{ "key": "value" }
To be used by the merchant when the client SDK does not provide one at the end of the flow
"https://www.test.gr4vy.app/transactions/1234/complete"
The integration clients
redirect, web, android, ios "redirect"
"web"
"android"
"ios"
Was this page helpful?