Provision a Network Token
curl --request POST \
--url https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"providerConfigId": "11111111-1111-1111-1111-111111111111"
}
'import requests
url = "https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken"
payload = { "providerConfigId": "11111111-1111-1111-1111-111111111111" }
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({providerConfigId: '11111111-1111-1111-1111-111111111111'})
};
fetch('https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken",
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([
'providerConfigId' => '11111111-1111-1111-1111-111111111111'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-idempotency-key: <x-idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken"
payload := strings.NewReader("{\n \"providerConfigId\": \"11111111-1111-1111-1111-111111111111\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
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.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"providerConfigId\": \"11111111-1111-1111-1111-111111111111\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"providerConfigId\": \"11111111-1111-1111-1111-111111111111\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": "<string>",
"resultDetail": "<string>",
"errors": [
"<string>"
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.malformed",
"detail": "The request has malformed syntax",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestmalformed"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.unauthorized",
"detail": "The request lacks necessary credentials to perform the specified action",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestunauthorized"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.not-found",
"detail": "The requested resource was not found",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestnot-found"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.rate-limit",
"detail": "Too many requests",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestrate-limit"
}
]
}Provision a Network Token
Provision a network token for a payment instrument, using the network token provider config ID you pass or, when you omit it, the default config.
POST
https://api.eu.staging.payrails.io
/
payment
/
instruments
/
{instrumentId}
/
provisionNetworkToken
Provision a Network Token
curl --request POST \
--url https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"providerConfigId": "11111111-1111-1111-1111-111111111111"
}
'import requests
url = "https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken"
payload = { "providerConfigId": "11111111-1111-1111-1111-111111111111" }
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({providerConfigId: '11111111-1111-1111-1111-111111111111'})
};
fetch('https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken",
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([
'providerConfigId' => '11111111-1111-1111-1111-111111111111'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-idempotency-key: <x-idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken"
payload := strings.NewReader("{\n \"providerConfigId\": \"11111111-1111-1111-1111-111111111111\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
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.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"providerConfigId\": \"11111111-1111-1111-1111-111111111111\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eu.staging.payrails.io/payment/instruments/{instrumentId}/provisionNetworkToken")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"providerConfigId\": \"11111111-1111-1111-1111-111111111111\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": "<string>",
"resultDetail": "<string>",
"errors": [
"<string>"
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.malformed",
"detail": "The request has malformed syntax",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestmalformed"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.unauthorized",
"detail": "The request lacks necessary credentials to perform the specified action",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestunauthorized"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.not-found",
"detail": "The requested resource was not found",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestnot-found"
}
]
}{
"errors": [
{
"id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
"code": "request.rate-limit",
"detail": "Too many requests",
"docUrl": "https://docs.payrails.com/docs/resources/error-codes#requestrate-limit"
}
]
}Authorizations
You can use an OAuth2 JWT bearer token in the Authorization header of your API requests for supported endpoints: Authorization: Bearer <YOUR_JWT_HERE>.
These tokens are valid for 10 minutes and can be requested via the access token endpoint endpoint.
Headers
Body
application/json
Request body for provisioning a network token.
Optional. The ID of the network token provider config to use for provisioning. When provided, the network token will be provisioned using the specified provider config. When omitted, the default network token provider config is used.
Example:
"11111111-1111-1111-1111-111111111111"
Response
Success.