Articles on: API

Getting started with the Downpay API

The Downpay API allows you to create advanced workflows around product deposits and partial payment workflows. For example, you can use the Downpay API to accomplish the following:

Programatically create purchase options on products.
Assign products to existing purchase options based on a condition or a trigger.
Collect the remaining balance on an order when a tag is applied to the order.
Authorize the customers stored payment method in advance of an order becoming fulfilled.



On this page:


API Reference

Getting Started
Endpoint
Authentication

Making your first API Call

Next steps



API Reference



Our API Documentation Site contains a full reference of API calls available to you.



Jump to top

Getting Started



You will first need to retrieve your API key. You can find the key on the Settings page of the Downpay app inside your Shopify Admin.

The Downpay API is a GraphQL API, similar to Shopify's. The rest of this article assumes a basic familiarity with GraphQL. In the screenshot below we use the Insomnia desktop client to call the Downpay API, but you can use any GraphQL client or programming environment that suits you.

Endpoint


All API calls go through the following endpoint:

https://downpay.hypehound.app/graphql
The HTTP method for all API calls is POST

Authentication


Calls to the API are authenticated through an HTTP header sent with each call. The header has the following properties:

Name: Authorization
Value: Token <your_api_key>

For example, if your API key is 12345abcdefg, then the full header will be:

Authorization: Token 12345abcdefg


With the endpoint and authorization header set, our GraphQL client configuration looks like this:






Jump to top

Making your first API Call



After configuring your GraphQL client you are ready to issue your first API call. The following will query Downpay for all purchase options that have been created for a store so far:

query AllPurchaseOptions {
    purchaseOptionGroups {
        nodes {
            createdAt
            id
            merchantCode
            productCount
        }
    }
}


Here we only select a few attributes of each deposit option. For a full list of attributes available to you, please consult the API reference

Provided that you have created some purchase options in the Downpay app, the return of the above query will look similar to this:

{
	"data": {
		"purchaseOptionGroups": {
			"nodes": [
				{
					"createdAt": "2024-01-23T15:51:07Z",
					"id": "610697371",
					"merchantCode": "Deposit Only",
					"productCount": 1
				}
			]
		}
	}
}




Jump to top

Next steps



After you've successfully made your first API calls, you're ready to integrate Downpay. The API can be an excellent addition to your low-code and workflow automation tools, such as Zapier or Shopify Flow. Here are some of the things that people have built using Downpay:

Triggering automated payment collection for a pre-order campaign days in advance of start of fulfillment.
Creating new purchase options for every new product. Very useful when each of your products has a different deferred payment due date.
Assigning newly created products to an existing Downpay purchase option when certain conditions are met, eg. when product cost is more than $1,000.
Pre-order campaign automation: adding a presale product to a purchase option at a specific time, and removing it after the presale period has ended.

There are many other possibilities, depending on what works best for your store. If you need a hand using the API or would like advice on the best approach to accomplish a particular workflow, please contact us!



Jump to top

Updated on: 22/03/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!