Skip to main content
Each Halliday payment includes fees for expenses like blockchain network gas costs, onramp provider fees, and other necessary costs. By default, end users cover these fees when their payment is funded. Halliday provides the option for the app developer to enable a feature that sponsors fees on behalf of their end users - up to 100% of the cost.

How fee sponsorship works

Whether it is an onramp or swap, each Halliday payment has an input currency amount and an output currency amount. Users fund their payment with the specified input amount and expect an approximate output amount based on conversion price, slippage, and fees. Due to the fact that the input amount is fixed, payment fees are incurred on the output currency amount. When fee sponsorship is enabled, a Halliday payment’s output amount is topped up with an approximate amount of the output currency, in effect, covering the fees of a payment. The app developer provides sponsorship for each payment from a single onchain balance of tokens.

Sponsorship balance

When enabling this Halliday feature, app developers are assigned an address which holds a balance of the output token as well as the gas token of the output token’s chain. To enable this feature, app developers must toggle fee sponsorship on in the Configuration section of the Halliday developer dashboard.
One balance address per organization is generated after a fee sponsorship profile is created. This address can hold many supported fee sponsorship tokens. The developer must send output tokens and gas tokens on the proper chain to this address. EVM addresses are the only supported addresses at this time.

Configuration and profile

The developer must set the maximum USD amount to cover in the dashboard. After this is configured, specific payments on the organization’s API keys will include fee sponsorship. Sponsorship profiles can be made in the dashboard. Each carries a routes array and can cover multiple output tokens. The developer can make make multiple sponsorship profiles, each with its own ID. This profile ID is specified when individual payment quotes are signed and confirmed (see below). Developers are responsible for maintaining the token balance that is used for fee sponsorship. If the fee sponsorship balance runs out, the end users will cover 100% of their payment fees while the balance is zero without the opportunity for reimbursement.

Eligible Routes

The fee sponsorhip profile builder in the Halliday dashboard has a selector field that limits the input and output tokens shown to valid routes.
Not all token routes are eligible for fee sponsorhip. In order for a token route to be eligible for fee sponsorhip, the input and output currencies must be a roughly equal price in fiat during normal market conditions. For example, an input of USD and output of USDC is valid because USDC is roughly equivalent to USD during normal market conditions. An input of USDC and an output of USDT is also valid. An input of USDC and output of WETH is not valid because the WETH token price is not intentionally pegged to USDC. A route of WETH -> WETH (on another chain) is valid because the fiat price of the input and output is roughly equal during normal market conditions.

Fee sponsorship technical details

Fee sponsorship works for integrations that utilize the Halliday SDK or the Halliday API. To avoid unauthorized use of fee sponsorship, the app developer must cryptographically sign payment quotes using their Halliday secret key. After the quote is signed, it is then confirmed via the Halliday API before the user can fund the payment with the input currency. Quote requests will fail if a signature in the request body is invalid or has already been used. App developers must host infrastructure to provide on-demand quote signatures. It is recommended that the developer host their own API endpoint in which sponsorships are validated and signed using the Halliday secret key. The next section is a walkthrough of configuring the client-side code with the SDK. For apps that use the Halliday API directly instead of the SDK, the following section can be skipped.

Client-side SDK configuration for fee sponsorship

Fee sponsorship settings in the SDK widget require an object with two parameters that is passed to the Halliday SDK configuration. The profileName is a string that is the name of the sponsorship profile. This is initially created in the Halliday dashboard. The generateGrant function is passed a quote payload. It must return the signature as a string wrapped in a JavaScript promise. The payload passed to generateGrant has the following types.
Here is an example of that payload. The Halliday SDK generates these payloads under the hood.
The following is an SDK widget configuration example with fee sponsorship included.
copy

Client-side API configuration for fee sponsorship

For developers using the API directly from front-end applications instead of the Halliday SDK, the process requires one additional step. Before fetching a collection of quotes from the Halliday API, a signed sponsorship grant payload needs to be created and signed. This fee_sponsorship object needs to be included in the /payments/quotes POST request body. The following is an example for creating the grant_payload that needs to subsequently be signed using the Halliday secret key.
Once this payload string is securely signed in a developer’s back-end server using the Halliday secret key, it is ready to be provided in a quote request from the client device.
The next section provides details on signing the grant_payload using the secret key.

Server-side configuration for fee sponsorship

App developers must create and provide access to a service for cryptographic signing of payment quotes that utilize fee sponsorship. These signatures are created using the secret key.

Getting the secret key

When an API key set is created in the Halliday Dashboard, the developer is provided two keys: the public key and the secret key. The public key begins with pk_ and is to be included in client-side app code. The secret key is provided once to the developer at the time of the key set creation. If this key is lost, the developer will need to create a new key set. The secret key, which begins with sk_, has organization level admin permissions on the Halliday API. Keep this key secured!

Creating a signature service

To create a valid signature, first create an HMAC key using the Halliday secret key. Remove the sk_ prepend and create the HMAC key, which is a 64-character lowercase hex SHA-256 string. Next, sign the JSON string of IFeeSponsorshipGrantPayload using the HMAC key. The following is an example of the signature process in a back-end server API endpoint using Node.js with the Express.js framework.