User APIhttps://api.datafuel.ai
Help centerOpenAPI spec

Payment methods

The balance and saved cards orders are charged to.

GET/api/v1/payment-methodsscope: api.<service>.purchase

List payment methods

The balance orders can be paid from and the saved cards they can be charged to. Pass a card's id as payment.card_id to charge that card; without it the default card is charged. Cards are added in the dashboard.

Requires the purchase level on at least one service.

Request
cURL
curl https://api.datafuel.ai/api/v1/payment-methods \
  --header 'Authorization: Bearer df_live_your_key_here'
Response

OK.

{
  "balance": {
    "available": 0,
    "currency": "usd"
  },
  "cards": [
    {
      "id": "pm_1QxYz",
      "brand": "visa",
      "last4": "4242",
      "exp_month": 0,
      "exp_year": 0,
      "default": false
    }
  ]
}

The API key is missing, invalid, expired or revoked.

{
  "error": "string",
  "message": "string",
  "meta": {}
}

The key lacks the scope named in meta.required (or the level in meta.required_level), is used from an IP it does not allow, or the account is suspended.

{
  "error": "string",
  "message": "string",
  "meta": {}
}

Too many requests for this key; retry after the Retry-After seconds.

{
  "error": "string",
  "message": "string",
  "meta": {}
}

Something failed on our side and was logged; read the resource again before retrying a change.

{
  "error": "string",
  "message": "string",
  "meta": {}
}