Skip to content

Billing Items

The Billing Item Object

{
"id": "1",
"amount_paid": "1234.00",
"currency": "USD",
"note": "Test payment",
"provider": {
"id": "1"
},
"recipient": {
"id": "1"
},
"sender": {
"id": "2"
}
}

Billing Items are BillingItem objects.

You can view the full list of available fields here.

Listing Billing Items

query billingItems(
$offset: Int
keywords: String
sort_by: String
state: String
provider_id: ID
offerings_only: Boolean
) {
billingItems(
offset: $offset,
keywords: $keywords,
sort_by: $sort_by,
state: $state,
provider_id: $provider_id,
offerings_only: $offerings_only
) {
id
amount_paid
currency
created_at
failure_reason
sender {
id
}
recipient {
id
}
}
}

Listing Billing Item is done via the billingItems query.

You can view a full list of potential arguments here.

InputInfo
offsetOptional. Offset for pagination.
sort_byOptional. Valid options are:
  • newest (default)
  • oldest
  • smallestamount
  • largestamount
  • patient_name_asc
  • patient_name_desc
  • provider_name_asc
  • provider_name_desc
  • method_asc
  • method_desc
  • state_asc
  • state_desc
keywordsOptional. Keywords to search by. Billing Items can be searched by amount_paid and payment_medium.
stateOptional. Valid options are:
  • failed
  • scheduled
  • succeeded
offerings_onlyOptional. Return only Billing Items that are associated to an offering.

Returns a list of BillingItem objects.

Retrieving a Billing Item

query billingItem($id: ID) {
billingItem(id: $id) {
id
amount_paid
currency
created_at
failure_reason
sender {
id
}
recipient {
id
}
}
}

Retrieving a specific Billing Item is done via the billingItem query.

InputInfo
idRequired. ID of the Billing Item to query.

Returns a BillingItem object.

Creating a Billing Item

mutation createBillingItem(
$amount_paid: String # e.g "567.53"
$sender_id: ID # e.g "61"
$requested_payment_id: ID # e.g 11
$stripe_idempotency_key: String # Stripe recommends using V4 UUIDs
$stripe_customer_detail_id: ID # e.g 21
$should_charge: Boolean # true
) {
createBillingItem(
input: {
amount_paid: $amount_paid
sender_id: $sender_id
should_charge: $should_charge
stripe_customer_detail_id: $stripe_customer_detail_id
requested_payment_id: $requested_payment_id
stripe_idempotency_key: $stripe_idempotency_key
}
) {
billingItem {
id
}
messages {
field
message
}
}
}

You can view a full list of potential inputs here.

InputInfo
created_atOptional. Used when tracking outside payments, and should be left out when actually charging a card.
amount_paidOptional. The amount to charging the patient. If left blank, the patient will be charged the full amount of the package or invoice.
noteOptional. Used to provide info about outside payments.
sender_idRequired. The ID of the patient to charge.
recipient_idOptional. The ID of the provider/staff member who should be listed as the recipient of the payment. This is primarily important in sitatuons where each provider has their own bank account. If left out, it defaults to the sender’s primary provider.
payment_mediumOptional. Used for outside payments and can be ignored.
offering_coupon_idOptional. is the ID of the promo code you want to apply to the payment. The promo code discount is applied to the initial payment amount. (e.g if you want to apply a 30% promo code, and have the client end up paying $700, you would pass in amount_paid of 1000).
offering_idThe ID of the package that the patient is paying for. If you are charging the patient for a package via an invoice connected to the package, you should send in the requested_payment_id instead.
should_chargeDetermine whether the charge actually runs through our payment processor. This should be passed in as true if you want to charge the card.
stripe_customer_detail_idOptional. The ID of the StripeCustomerDetail (e.g the payment source) that the patient is using to pay. If left out, the patient is charged on their default payment source.
requested_payment_idOptional. The ID of the invoice that the patient is paying for. You can have the patient make multiple payments that apply to the same invoice. To do so, just include the same requested_payment_id in each charge.
user_package_selection_idOptional. Is only used if you are charging a patient for an existing UserPackageSelection.
stripe_idempotency_keyOptional. A key generated on the front-end that is used by Stripe to prevent duplicate requests. Find more info about them here. This is optional, but highly recommended.

Returns a createBillingItemPayload object.

Sometimes the charge will be declined by the card issuer. The decline reason is included in the messages you can get back from the mutation. For more information on specific decline reasons, please view Stripe’s list of decline codes.

Updating a Billing Item

mutation updateBillingItem(
$id: ID
$amount_paid: String # e.g "567.53"
$sender_id: ID # e.g "61"
$stripe_idempotency_key: String # Stripe recommends using V4 UUIDs
$resend_payment: Boolean
) {
updateBillingItem(
input: {
id: $id
amount_paid: $amount_paid
sender_id: $sender_id
stripe_idempotency_key: $stripe_idempotency_key
resend_payment: $resend_payment
}
) {
billingItem {
id
}
messages {
field
message
}
}
}

You can view a full list of potential inputs here.

InputInfo
idRequired. The ID of the Billing Item to update.
created_atOptional. Used when tracking outside payments, and should be left out when actually charging a card.
amount_paidOptional. The amount to charging the patient. If left blank, the patient will be charged the full amount of the package or invoice.
noteOptional. Used to provide info about outside payments.
sender_idOptional. The ID of the patient to charge.
recipient_idOptional. The ID of the provider/staff member who should be listed as the recipient of the payment. This is primarily important in sitatuons where each provider has their own bank account. If left out, it defaults to the sender’s primary provider.
payment_mediumOptional. Used for outside payments and can be ignored.
chosen_refund_amountOptional. If provided, a given amount will be refunded to the sender.
is_canceledOptional. If set to true, the payment will be cancelled.
resend_receiptOptional. Set to true to resend the receipt to sender.
is_pausedOptional. If set to true, will pause the recurring payment.
resend_paymentOptional. Use this to retry a failed payment. It’s highly recommended to use combined with stripe_idempotency_key.
new_payment_dateOptional. Update the payment day of a recurring payment.
stripe_idempotency_keyOptional. A key generated on the front-end that is used by Stripe to prevent duplicate requests. Find more info about them here. This is optional, but highly recommended.

Returns an updateBillingItemPayload object.

Sometimes the charge will be declined by the card issuer. The decline reason is included in the messages you can get back from the mutation. For more information on specific decline reasons, please view Stripe’s list of decline codes.

Deleting a Billing Item

Billing Items can be (soft) deleted by authorized providers and staff members via the deleteBillingItem mutation.

You can view a full list of potential inputs here.

mutation deleteBillingItem($id: ID) {
deleteBillingItem(input: { id: $id }) {
billingItem {
id
}
messages {
field
message
}
}
}

The deleteBillingItem mutation is called from an authenticated provider/staff account.

InputInfo
idRequired. ID of the Billing Item to delete.

Returns a deleteBillingItemPayload object.