Skip to content

Instantly share code, notes, and snippets.

@deniszgonjanin
Last active March 8, 2024 15:41
Show Gist options
  • Save deniszgonjanin/5901afe7d82736e577284b44d286deeb to your computer and use it in GitHub Desktop.
Save deniszgonjanin/5901afe7d82736e577284b44d286deeb to your computer and use it in GitHub Desktop.
Programatically collecting the remaining order payment in Downpay

Programatically collecting the remaining order payment in Downpay

In order to programatically collec the remaining balance for a Downpay-enabled order, you can use the orderCollectPayment mutation.

Query:

mutation collect($input: OrderCollectPaymentInput!) {
  orderCollectPayment(input: $input) {
    errors {
      field
      message
    }
    orderPaymentStatus {
      createdAt
      orderId
      paymentReferenceId
    }
  }
}

And pass the ID of the Shopify order as a variable to the call:

{
  "input": {
    "id": "5417007087834"
  }
}

The API call will return no errors in the case of a successful collection. The Order object in Shopify will be correspondingly updated to show that it has been fully paid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment