Skip to main content
POST
/
payment-services
/
{payment_service_id}
/
sessions
C#
using Gr4vy;
using Gr4vy.Models.Components;
using System.Collections.Generic;

var sdk = new Gr4vySDK(
    id: "example",
    server: SDKConfig.Server.Sandbox,
    bearerAuthSource: Auth.WithToken(privateKey),
    merchantAccountId: "default"
);

var res = await sdk.PaymentServices.SessionAsync(
    paymentServiceId: "fffd152a-9532-4087-9a4f-de58754210f0",
    requestBody: new Dictionary<string, object>() {

    }
);

// handle response
{
  "type": "payment-service-session",
  "status": "succeeded",
  "code": "UNKNOWN_ERROR",
  "status_code": 201,
  "response_body": {
    "sessionId": "12345"
  }
}
This endpoint requires the transactions.write scope.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-gr4vy-merchant-account-id
string

The ID of the merchant account to use for this request.

Examples:

"default"

Path Parameters

payment_service_id
string<uuid>
required

the ID of the payment service

Examples:

"fffd152a-9532-4087-9a4f-de58754210f0"

Body

application/json · Body · object

The JSON payload to sent to the payment service's session API.

Response

Successful Response

The session data received from the payment service.

status
string
required

The status of the response.

type
string
default:payment-service-session

Always payment-service-session.

Allowed value: "payment-service-session"
Examples:

"payment-service-session"

code
string | null

A generic error code that may be returned when the session could not be generated.

Examples:

"UNKNOWN_ERROR"

status_code
integer | null

The HTTP status code received from the payment service.

Examples:

201

response_body
object | null

The JSON response body received from the payment service.

Examples:
{ "sessionId": "12345" }