Introduction Learn the basics of the Payyo API

In Short

Payyo offers a JSON-RPC interface via HTTPS. Following are the main characteristics of the API:

  • The base URL for all API requests is https://api.payyo.ch/v2.
  • The API only speaks JSON-RPC. All response bodies are JSON and all request bodies are expected to be JSON.
    • Clients must send an Accept header which permits the application/json content type.
    • Clients must send a valid JSON-RPC (version 2.0) request body.
    • Clients must send POST requests only.
    • Clients must send a Content-Type: application/json for all requests.
  • All requests must contain a valid Authorization header authenticating the client and proving the integrity of the request. Read more on this on the Authentication page.

Example Request and Response

{
  "jsonrpc": "2.0",
  "method": "transaction.capture",
  "params": {
    "merchant_id": 100001,
    "transaction_id": "tra_8e7832a8c1594f8fcdd5a301c127"
  },
  "id": 1
}
{
  "jsonrpc": "2.0",
  "result": {
    "transaction_id": "tra_8e7832a8c1594f8fcdd5a301c127",
    "status": "captured"
  },
  "id": 1
}

HTTP Status Codes

In general the API will return a JSON-RPC response body along with status code 200. To see if your request succeeded you'll have to consult the response body.

In case of an error the response will contain an error instead of a result property.

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32700,
    "message": "Parse error"
  },
  "id": null
}

You can read more on this in the JSON-RPC Specification.

Read more about all possible error codes.

The API will return with a non-200 status code in case you didn't make the request against the propert JSOn-RPC endpoint.