Skip to main content
POST
/
payment-methods
/
{payment_method_id}
/
network-tokens
/
{network_token_id}
/
cryptogram
Issue cryptogram
using RestSharp;


var options = new RestClientOptions("https://api.sandbox.{id}.gr4vy.app/payment-methods/{payment_method_id}/network-tokens/{network_token_id}/cryptogram");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n  \"merchant_initiated\": false\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/payment-methods/{payment_method_id}/network-tokens/{network_token_id}/cryptogram"

payload := strings.NewReader("{\n \"merchant_initiated\": false\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/payment-methods/{payment_method_id}/network-tokens/{network_token_id}/cryptogram")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"merchant_initiated\": false\n}")
.asString();
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.{id}.gr4vy.app/payment-methods/{payment_method_id}/network-tokens/{network_token_id}/cryptogram",
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([
'merchant_initiated' => false
]),
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/payment-methods/{payment_method_id}/network-tokens/{network_token_id}/cryptogram"

payload = { "merchant_initiated": False }
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({merchant_initiated: false})
};

fetch('https://api.sandbox.{id}.gr4vy.app/payment-methods/{payment_method_id}/network-tokens/{network_token_id}/cryptogram', 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/payment-methods/{payment_method_id}/network-tokens/{network_token_id}/cryptogram \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"merchant_initiated": false
}
'
{
  "cryptogram": "<string>"
}
{
"type": "error",
"code": "bad_request",
"status": 400,
"message": "Missing '****' field",
"details": [
{
"location": "body",
"type": "value_error.missing",
"pointer": "/payment_method/number",
"message": "field required"
}
]
}
{
"type": "error",
"code": "unauthorized",
"status": 401,
"message": "No valid API authentication found",
"details": []
}
{
"type": "error",
"code": "forbidden",
"status": 403,
"message": "Invalid credentials",
"details": []
}
{
"type": "error",
"code": "not_found",
"status": 404,
"message": "The resource could not be found",
"details": []
}
This endpoint requires the payment-methods.write scope. Network token provisioning via the API is not enabled by default in production. Please contact support for further guidance.

Authorizations

Authorization
string
header
required

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

Path Parameters

payment_method_id
string<uuid>
required

The ID of the payment method.

Example:

"46973e9d-88a7-44a6-abfe-be4ff0134ff4"

network_token_id
string<uuid>
required

The ID of the network token.

Example:

"454f6a32-a572-4dda-b885-3e8674086123"

Body

application/json

Request body for issue a cryptogram for a network token.

merchant_initiated
boolean
default:false
required

Defines if the request is merchant initiated or not.

Example:

false

Response

Returns the created network token.

A network token cryptogram.

cryptogram
string

The cryptogram of the network token.