Getting started
Payva helps you sell to more customers by letting them pay over time. Whether you sell through your own Payva checkout links or a partner platform, Payva approves your customers, takes care of their payments and pays you, either upfront or as payments come in.
The Merchant API gives your systems the same data you see in the Payva portal, so you can report on sales, reconcile payouts and automate how you sell.
Overview
The Payva Merchant API lets your systems read and manage your Payva orders, payments, payouts, products and payment links from code. Get a key, send one request, and you’re in.
| API URL | https://merchant.api.payva.com/graphql |
| Method | POST, with a JSON body |
| Auth header | x-api-key: <your API key> |
Every request goes to that one URL. There are no other endpoints to learn. There is no sandbox or test environment today, so every key works against your live account.
New to GraphQL? A good starting point is the official Introduction to GraphQL (opens in a new tab).
Step 1: Create an API key
- Sign in to the Payva merchant portal.
- Open Settings, then API keys (under Developers).
- Select Create key, name it after the system that will use it, such as “Order reporting” or “CRM sync”, and select Create key again.
- Copy the API key value with the copy icon next to it. This is what goes in the
x-api-keyheader. You can come back and copy it again later.
The page also shows a Secret key, which can only be viewed once. The Merchant API does not use it.
Rotate or revoke a key
Both live on the same API keys page, next to each key.
- Rotate issues a new key. The old key stops working right away, so update your integration as soon as you rotate. To switch with no downtime, create a second key, move your integration to it, then revoke the old one.
- Revoke stops the key immediately. This cannot be undone.
- If a key may have leaked, revoke it and create a new one.
What your key can access
Today, an API key belongs to your business, not to the person who created it.
- It can see everything on your merchant account: every order, payment, payout, product and team member.
- It keeps working if the person who created it leaves your team. Revoke it if you no longer trust where it is stored.
- Anyone who has the key has that same access, so treat it like a password to your whole account.
- Authentication: headers and key errors
Step 2: Make your first call
This request returns your most recent order. Swap in your key and run it.
Example
query MostRecentOrder {
orders(input: { first: 1 }) {
edges { node { orderId status orderTotal orderDate } }
}
}{
"data": {
"orders": {
"edges": [
{
"node": {
"orderId": "100235",
"status": "ACTIVE",
"orderTotal": 10000,
"orderDate": "2026-07-14T15:32:08.000Z"
}
}
]
}
}
}If you get back data, your key works. If you get an errors array with UNAUTHORIZED, check the key. If it says FORBIDDEN, your account isn’t enabled for the API yet.
Next steps
- Errors: the error codes and what to do about each
- Pagination: how lists page through results
- How you get paid: payouts, clawbacks and the recourse threshold
Authentication
Send your API key in the x-api-key header on every request to https://merchant.api.payva.com/graphql. Your key tells us which business you are, so you never send an account ID.
Keep it on your server
Never put your key in a website, a mobile app or a public code repository. Anyone who has it can see and change your whole account.
It works on live data
There are no test keys. Every call reads and changes your real account.
It belongs to your business
A key isn’t tied to the person who created it. Some changes, such as making someone an owner, can only be made in the merchant portal for now. Keys tied to a team member are coming in a future release.
When a key doesn’t work
UNAUTHORIZED means the key is missing, wrong, expired, rotated or revoked. FORBIDDEN means your account isn’t enabled for the API yet; contact your account manager.
Headers
| Name | Type | Description |
|---|---|---|
x-api-key | headerrequired | Your API key, from Settings > API keys in the merchant portal. It starts with pv_sk_live_. |
Content-Type | headerrequired | application/json |
Example
# A first request: confirm your key works
POST https://merchant.api.payva.com/graphql
Content-Type: application/json
x-api-key: pv_sk_live_example_0000000000000000
{ "query": "{ orders(input: { first: 1 }) { totalCount } }" }{
"data": {
"orders": {
"totalCount": 148
}
}
}Errors
When something goes wrong, the response has an errors array. Each error has a code in extensions. Branch on the code, not the message, because message text can change.
Check the body, not the status
Most errors still return HTTP 200. Look for an errors array in the response. Only a query that can’t run at all (bad syntax, wrong variable types) returns HTTP 400. A missing or bad API key returns HTTP 401, and an account without API access gets HTTP 403.
One problem at a time
A bad argument returns the first problem found. Fix it and send again to see the next one.
Missing records
Looking up one record that isn’t on your account returns null. Changing one returns NOT_FOUND.
Retrying safely
Reads are always safe to retry. Creates are not: if one times out, check whether it went through before sending it again, or you may end up with two.
Error codes
| Code | What it means | What to do |
|---|---|---|
INVALID_REQUEST | Something in the request is missing, malformed or the wrong format | Read the message, fix the request, resend |
UNAUTHORIZED | The API key is missing, wrong, expired, rotated or revoked | Check the x-api-key header |
FORBIDDEN | Your key works, but your account isn’t enabled for this, or the change can only be made in the portal | Contact your account manager |
NOT_FOUND | You tried to change a record that isn’t on your account | Check the ID |
INTERNAL_SERVER_ERROR | Something went wrong on our side | Retry reads. Check before retrying a create |
Response
| Field | Type | Description |
|---|---|---|
data | Object | The fields you asked for. A field that failed is null, and its error is in errors. data itself is null or absent when the request could not run. |
errors | [Error!] | Present only when something failed. Each error carries a message and an extensions.code you can branch on. |
Example
{
"errors": [
{
"message": "Payment link not found",
"extensions": {
"code": "NOT_FOUND"
}
}
],
"data": null
}{
"errors": [
{
"message": "Missing API key",
"extensions": {
"code": "UNAUTHORIZED"
}
}
],
"data": null
}Pagination
Every list returns results in pages. You get up to 25 results by default, and up to 100 if you ask.
- Ask for a page with input: { first: 100 }.
- If
pageInfo.hasNextPage istrue, send the same request again with after set topageInfo.endCursor. - Repeat until
hasNextPageisfalse.
totalCount on every page tells you how many results match your filter in total.
Pages don’t shift
New orders arriving while you page through won’t move or repeat results. The 400th page is as fast as the first.
Keep the sort the same
Changing sortBy or sortDesc partway through starts over from the first page. Pass cursors back exactly as you got them.
Arguments
| Name | Type | Description |
|---|---|---|
input.first | Int | Page size, 1–100. Defaults to 25 on every list. |
input.after | String | The endCursor of the page you already have. A value that is not a cursor is refused with INVALID_REQUEST. |
Response
| Field | Type | Description |
|---|---|---|
totalCount | Int! | Everything that matches your filter, not just this page. |
pageInfo.hasNextPage | Boolean! | True while there is more to fetch. |
pageInfo.endCursor | String | Pass it as after. Null on an empty page. |
edges[].cursor | String! | The position of that one row, if you want to resume from the middle of a page. |
Example
query Walk($input: OrdersInput) {
orders(input: $input) {
totalCount
pageInfo { hasNextPage endCursor }
edges { node { orderId status } }
}
}{
"input": {
"first": 100,
"after": "eyJzb3J0ZWRGaWVsZCI6Ik9SREVSX0RBVEUiLCJkaXJlY3Rpb24iOiJERVNDIiwidmFsdWUiOiIyMDI2LTA4LTAxIDAwOjAwOjAwIiwiaWQiOjkwMDAwMjB9"
}
}{
"data": {
"orders": {
"totalCount": 148,
"pageInfo": {
"hasNextPage": false,
"endCursor": "eyJzb3J0ZWRGaWVsZCI6Ik9SREVSX0RBVEUiLCJkaXJlY3Rpb24iOiJERVNDIiwidmFsdWUiOiIyMDI2LTAzLTAyIDAwOjAwOjAwIiwiaWQiOjkwMDAwMDF9"
},
"edges": [
{
"node": {
"orderId": "100219",
"status": "ACTIVE"
}
}
]
}
}
}How you get paid
Every order pays you out one of two ways: UPFRONT or PAC. The route decides when you get paid, and whether money can be taken back later.
UPFRONT
You’re paid at the start of the order, before your customer has paid it off. payoutAmount and payoutPercent on the order show what you were paid.
PAC (pay as collected)
You’re paid as each customer payment comes in. Your payouts follow your customer’s payments.
How an order gets its route
You get paid on every order. Low-risk pays upfront. Higher-risk orders route through PAC, paying out as your customer pays.
Each product has a route setting:
| Product route | What happens at checkout |
|---|---|
| AUTOROUTE | The credit check decides. Good credit pays UPFRONT. Weaker credit goes to PAC instead of being declined. |
| UPFRONT_ONLY | Good credit pays UPFRONT. Weaker credit is declined. |
| PAC_ONLY | Every approved order pays as collected. |
Clawbacks
If your customer stops paying after you’ve been paid upfront, Payva takes some of that payout back. A clawback shows in payouts and transactions as a negative PAYOUT with the CLAWBACK sub-type.
When an order is safe
Once your customer has paid off enough of an UPFRONT order, it can no longer be clawed back. recourseThresholdMet turns true and clawbackAtRisk becomes null.
Sales through another platform
If the order came through a partner platform, the payout goes to that platform, and they pay you.
Example
query Payouts($input: OrdersInput) {
orders(input: $input) {
edges { node {
orderId orderTotal
payoutSummary { payoutAmount payoutPercent payoutToDate }
} }
}
}{
"input": {
"first": 2
}
}{
"data": {
"orders": {
"edges": [
{
"node": {
"orderId": "100235",
"orderTotal": 10000,
"payoutSummary": {
"payoutAmount": 8000,
"payoutPercent": 80,
"payoutToDate": 8000
}
}
},
{
"node": {
"orderId": "100219",
"orderTotal": 6000,
"payoutSummary": {
"payoutAmount": null,
"payoutPercent": null,
"payoutToDate": 3040
}
}
}
]
}
}
}Types
RouteEnum
How you are paid out on an order. See How an order gets its route for how a product’s route setting decides it.
| Value | Meaning |
|---|---|
UPFRONT | Paid out upfront, at the start of the order. |
PAC | Paid out as each customer payment comes in. |
PENDING | The route is not decided yet, as on a pending plan. |
INVALID | The stored route is not valid. |