Skip to main content
POST
/
api
/
v1
/
buy
Create a buy transaction
curl --request POST \
  --url https://payments.oaknetwork.org/api/v1/buy \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "provider": "<string>",
  "source": {
    "amount": 2,
    "currency": "<string>",
    "customer": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    },
    "payment_method": {
      "type": "<string>"
    }
  },
  "destination": {
    "currency": "<string>",
    "payment_method": {
      "type": "<string>",
      "chain": "<string>"
    }
  },
  "metadata": {}
}
'
{
  "msg": "<string>",
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "status": "<string>",
    "type": "<string>",
    "provider": "<string>",
    "source": {
      "amount": 123,
      "currency": "<string>",
      "customer": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      },
      "payment_method": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "type": "<string>",
        "chain": "<string>"
      }
    },
    "destination": {
      "amount": 123,
      "currency": "<string>",
      "customer": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      },
      "payment_method": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "type": "<string>",
        "chain": "<string>"
      }
    },
    "metadata": {},
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "settlement_date": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

Merchant authentication token. Obtained via POST /api/v1/merchant/token/grant. Pass as: Authorization: Bearer

Body

application/json
provider
string
required

Provider name (case-insensitive)

source
object
required
destination
object
metadata
object

Merchant-supplied arbitrary metadata, stored with the transaction and echoed back on derived webhook deliveries. Shape is defined by the merchant at request time.

Response

Buy transaction initiated

msg
string
required

Human-readable message describing the result

data
object
required

Transaction object (field casing in response is lowercased for status, type, provider, currency)