|
1
|
--- |
|
2
|
title: "ProcureNet API Keys, Networks, and VCI Bridge Setup" |
|
3
|
sidebarTitle: "Environment" |
|
4
|
description: "Configure API credentials, payment networks, and VCI bridge options to connect your application to ProcureNet's orchestration API." |
|
5
|
--- |
|
6
|
|
|
7
|
ProcureNet exposes a set of configuration options you control through your account settings and API keys. This page covers the **customer-configurable** settings only — what you pass in API calls and set in your application. You will not need to touch any infrastructure; every option described here is a value you supply at initialization time or as an HTTP header. |
|
8
|
|
|
9
|
## API Credentials |
|
10
|
|
|
11
|
ProcureNet uses four distinct credentials, each scoped to a specific surface. Keep them in separate environment variables and never commit them to source control. |
|
12
|
|
|
13
|
<CardGroup cols={2}> |
|
14
|
<Card title="Wallet API Key" icon="key"> |
|
15
|
Passed as the `x-perplexity-mod-key` header on all wallet and payment |
|
16
|
endpoints. Obtain this from the **API Keys** section of your ProcureNet |
|
17
|
dashboard. |
|
18
|
</Card> |
|
19
|
<Card title="JWT Bearer Token" icon="lock"> |
|
20
|
Passed as `Authorization: Bearer <token>` on session endpoints. Generated |
|
21
|
when you authenticate your account via ProcureNet's auth flow. |
|
22
|
</Card> |
|
23
|
<Card title="Webhook Secret" icon="webhook"> |
|
24
|
Used to verify the `x-procure-signature` HMAC on inbound Procurement |
|
25
|
Express callbacks. Copy it from the **Webhooks** tab in your dashboard. |
|
26
|
</Card> |
|
27
|
<Card title="Admin Key" icon="shield"> |
|
28
|
Passed as `x-admin-key` when triggering manual payment confirmation. |
|
29
|
Keep this completely separate from your regular API key and restrict |
|
30
|
its use to server-side code only. |
|
31
|
</Card> |
|
32
|
</CardGroup> |
|
33
|
|
|
34
|
<Tip> |
|
35
|
Store all four credentials as environment variables (e.g., `PROCURENET_API_KEY`, `PROCURENET_JWT`, `PROCURENET_WEBHOOK_SECRET`, `PROCURENET_ADMIN_KEY`). Reference them at runtime — never hard-code credential strings in your source files. |
|
36
|
</Tip> |
|
37
|
|
|
38
|
<Warning> |
|
39
|
The admin key (`x-admin-key`) carries elevated privileges that can override payment confirmation. Restrict it to server-side processes only and rotate it immediately if it is ever exposed. |
|
40
|
</Warning> |
|
41
|
|
|
42
|
--- |
|
43
|
|
|
44
|
## Payment Networks |
|
45
|
|
|
46
|
Every USDC payment request targets a specific EVM network. You choose the network per request by passing the `network` field in your payment payload. |
|
47
|
|
|
48
|
| Network | When to use | |
|
49
|
| ----------- | -------------------------------------------------------- | |
|
50
|
| `base` | Recommended default — lowest transaction fees | |
|
51
|
| `arbitrum` | Low fees with broad DeFi ecosystem support | |
|
52
|
| `polygon` | Established network with wide wallet compatibility | |
|
53
|
| `ethereum` | Maximum compatibility when recipients require mainnet | |
|
54
|
|
|
55
|
<Info> |
|
56
|
Use `base` for the majority of field evaluator payouts to minimize on-chain costs. Switch to `ethereum` only when a recipient's wallet does not support Layer 2 networks. |
|
57
|
</Info> |
|
58
|
|
|
59
|
--- |
|
60
|
|
|
61
|
## VCI Bridge Configuration |
|
62
|
|
|
63
|
The `VCIProcureNetBridge` connects your offline VCI evaluation queue to ProcureNet's USDC wallet. You configure its behavior through two options passed to `ProcureNetWalletClient`. |
|
64
|
|
|
65
|
<ParamField body="autoWatch" type="boolean" default="true"> |
|
66
|
When `true`, the bridge automatically polls for on-chain confirmation after |
|
67
|
creating a payment request — no extra calls needed from your side. Set to |
|
68
|
`false` if you want to control the confirmation check yourself by calling |
|
69
|
`processWalletSettlement()` and `manualConfirmPayment()` explicitly. |
|
70
|
</ParamField> |
|
71
|
|
|
72
|
<ParamField body="tenantIdResolver" type="() => string" default="() => 'default-tenant'"> |
|
73
|
A function you provide that returns your tenant ID string. The bridge calls |
|
74
|
this resolver each time it creates a payment, so you can return a dynamic |
|
75
|
value (e.g., from your session context) if you operate multiple tenants. |
|
76
|
</ParamField> |
|
77
|
|
|
78
|
### Initialization example |
|
79
|
|
|
80
|
Pass your base URL and API key to `ProcureNetWalletClient`, then hand the client to `VCIProcureNetBridge` alongside your queue adapter and tenant resolver. |
|
81
|
|
|
82
|
<CodeGroup> |
|
83
|
|
|
84
|
```typescript TypeScript |
|
85
|
import { |
|
86
|
ProcureNetWalletClient, |
|
87
|
VCIProcureNetBridge, |
|
88
|
} from '@procurenet/vci-bridge'; |
|
89
|
|
|
90
|
const wallet = new ProcureNetWalletClient( |
|
91
|
'https://api.procurenet.io', // base URL |
|
92
|
process.env.PROCURENET_API_KEY!, // x-perplexity-mod-key |
|
93
|
{ autoWatch: true } // watch for on-chain confirmation automatically |
|
94
|
); |
|
95
|
|
|
96
|
const bridge = new VCIProcureNetBridge( |
|
97
|
myQueueAdapter, // your QueueLike implementation |
|
98
|
wallet, |
|
99
|
() => process.env.TENANT_ID! // tenantIdResolver |
|
100
|
); |
|
101
|
``` |
|
102
|
|
|
103
|
```typescript Manual confirmation (autoWatch: false) |
|
104
|
import { |
|
105
|
ProcureNetWalletClient, |
|
106
|
VCIProcureNetBridge, |
|
107
|
} from '@procurenet/vci-bridge'; |
|
108
|
|
|
109
|
const wallet = new ProcureNetWalletClient( |
|
110
|
'https://api.procurenet.io', |
|
111
|
process.env.PROCURENET_API_KEY!, |
|
112
|
{ autoWatch: false } // you will call manualConfirmPayment() yourself |
|
113
|
); |
|
114
|
|
|
115
|
const bridge = new VCIProcureNetBridge(myQueueAdapter, wallet); |
|
116
|
|
|
117
|
// Later, after the evaluator submits offline data: |
|
118
|
const result = await bridge.manualConfirmPayment( |
|
119
|
localEvaluationId, |
|
120
|
process.env.PROCURENET_ADMIN_KEY! |
|
121
|
); |
|
122
|
|
|
123
|
if (result.confirmed) { |
|
124
|
console.log('Payment confirmed on-chain:', result.transaction_hash); |
|
125
|
} |
|
126
|
``` |
|
127
|
|
|
128
|
</CodeGroup> |