In order to programatically collec the remaining balance for a Downpay-enabled order, you can use the orderCollectPayment
mutation.
- Endpoint: https://downpay.hypehound.app/graphql
- Authorization: set an HTTP header with the name 'Authorization' and value 'Token <your_downpay_api_key>'
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.