Skip to main content
POST
/
payment-methods
/
{payment_method_id}
/
network-tokens
C#
using Gr4vy;
using Gr4vy.Models.Components;

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

var res = await sdk.PaymentMethods.NetworkTokens.CreateAsync(
    paymentMethodId: "ef9496d8-53a5-4aad-8ca2-00eb68334389",
    networkTokenCreate: new NetworkTokenCreate() {
        MerchantInitiated = false,
        IsSubsequentPayment = false,
    }
);

// handle response
{
  "type": "network-token",
  "id": "918f6c9b-5d11-4897-98dc-23fda6fe0055",
  "expiration_date": "12/30",
  "payment_method_id": "ef9496d8-53a5-4aad-8ca2-00eb68334389",
  "status": "active",
  "token": "4111123456789012",
  "created_at": "2013-07-16T19:23:00.000+00:00",
  "updated_at": "2013-07-16T19:23:00.000+00:00"
}
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.

Headers

x-gr4vy-merchant-account-id
string | null

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

Examples:

"default"

Path Parameters

payment_method_id
string<uuid>
required

The ID of the payment method

Examples:

"ef9496d8-53a5-4aad-8ca2-00eb68334389"

Body

application/json
merchant_initiated
boolean
required

Defines if the request is merchant initiated or not.

Examples:

false

is_subsequent_payment
boolean
required

Defines if the request is a subsequent of another request or not.

Examples:

false

security_code
string | null

The 3 or 4 digit security code often found on the card. This often referred to as the CVV or CVD.

Required string length: 3 - 4
Examples:

"123"

Response

Successful Response

id
string<uuid>
required

The ID for the network token.

Examples:

"918f6c9b-5d11-4897-98dc-23fda6fe0055"

expiration_date
string
required

The expiration date for the network token.

Required string length: 5
Examples:

"12/30"

payment_method_id
string<uuid>
required

The ID of the payment method used to generate this token

Examples:

"ef9496d8-53a5-4aad-8ca2-00eb68334389"

status
enum<string>
required

The state of the network token.

Available options:
active,
inactive,
suspended,
deleted
token
string
required

The token value. Will be present if succeeded.

Required string length: 1 - 300
Examples:

"4111123456789012"

created_at
string<date-time>
required

The date and time when this network token was first created in our system.

Examples:

"2013-07-16T19:23:00.000+00:00"

updated_at
string<date-time>
required

The date and time when this network token was last updated in our system.

Examples:

"2013-07-16T19:23:00.000+00:00"

type
string
default:network-token

Always network-token.

Allowed value: "network-token"
Examples:

"network-token"