Paying for orders

Specifying a funding source to pay for an order

The vast majority of API orders use balance as the funding source. To pay for an order with your balance, you can simply use balance as the funding_source_id in the order request.
To use a different funding source to pay for an order, you can query the Funding sources resource to find the ID of the funding source:

curl --url 'https://testflight.tremendous.com/api/v2/funding_sources' \
     --header 'Authorization: Bearer YOUR-API-KEY'
{
  "funding_sources": [
    {
      "method": "balance",
      "id": "GCTHLCMFVYMD",
      "usage_permissions": [
        "api_orders", 
        "dashboard_orders"
      ],
      "status": "active",
      "meta": {
        "available_cents": 600000,
        "pending_cents": 0
      }
    },
    {
      "method": "invoice",
      "usage_permissions": [
        "api_orders"
      ],
      "status": "active",
      "type": "COMMERCIAL",
      "id": "4G1IPSQINMMV"
    }
  ]
}

First, check that the funding source is active, and that the usage_permissions field contains api_orders.
Then use the id as the funding_source_id in your API call to /api/v2/orders:

curl --url 'https://testflight.tremendous.com/api/v2/orders' \
     --header 'Authorization: Bearer YOUR-API-KEY' \
     --header 'Content-Type: application/json' \
     --data '
{
    "payment": {
        "funding_source_id": "YOUR-SELECTED-SOURCE-ID"
    },
    "reward": {
        "value": {
            "denomination": 50
        },
        "delivery": {
            "method": "EMAIL"
        },
        "recipient": {
            "name": "Jane Doe",
            "email": "[email protected]"
        },
        "products": [
            "OKMHM2X2OHYV"
        ]
    }
}
'