Developers
Start building
AI/Tool reference/Orders/Payments

Payments

The 14 tools of the Payments toolset in the Orders area, with their permissions, approval rules and inputs.

On this page

Toolset payments, 14 tools.

Records

payment

A payment on an order, with its captures and refunds. A payment is found through the order: get the order with include payments for its payment ids.

  • Permission: orders.read
  • Tools: payment_list, payment_get
  • Sorts: created_at, updated_at

Filters on the list:

FilterTypeRequiredDescription
qstring
payment_session_idstring

payment_provider

A payment provider installed in the store; its id is what mark_paid and the order payments name. Which regions offer it is a setting a person makes.

  • Permission: orders.read
  • Tools: payment_provider_list

Filters on the list:

FilterTypeRequiredDescription
is_enabledbooleanOnly enabled providers

refund_reason

A reason a refund can be filed under; pass its id to payment_refund.

  • Permission: orders.read
  • Tools: refund_reason_list, refund_reason_get
  • Sorts: created_at

Filters on the list:

FilterTypeRequiredDescription
qstring

Actions

order_credit_line_create

Settle an order's pending difference with a credit line instead of a payment or refund.

Only valid while the order has a pending difference: a positive amount settles money the customer still owes, a negative one money owed back, and neither may exceed the difference. amount is in the order currency. reference says what the credit is for and reference_id points at it. Nothing is charged or paid out.

  • Action key: order_credit_line.create
  • Permission: orders.refund
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
FieldTypeRequiredDescription
order_idstringyesOrder ID (order_…)
amountnumberyesCredit in the order currency; negative when money is owed back
referencestringyesWhat the credit is for, such as "refund". at least 1 characters
reference_idstringyesID of the thing the credit refers to. at least 1 characters
metadatamap of string or number or boolean or list of any value or map of any value or null

Example input:

{
  "order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a",
  "amount": -1200,
  "reference": "refund",
  "reference_id": "refund_01J9"
}

payment_capture

Capture an authorized payment, in full or in part.

Most card and wallet providers settle a payment once: they capture only everything still open, and a smaller amount is refused with payment_partial_capture_unsupported. Then capture in full and refund the difference instead.

  • Action key: payment.capture
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
FieldTypeRequiredDescription
payment_idstringyesPayment ID (pay_…)
amountnumberOmit to capture the full authorized amount. above 0

Example inputs:

{
  "payment_id": "019bb4b5-6430-7a01-8e17-6df1bfccb8e5"
}
{
  "payment_id": "019bb4b5-6430-7a01-8e17-6df1bfccb8e5",
  "amount": 4990
}

payment_collection_create

Open a payment collection on an order for an amount still to be paid.

Nothing is charged: it only opens the amount for payment. Mark it paid with payment_mark_paid once the money arrived.

  • Action key: payment_collection.create
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
FieldTypeRequiredDescription
order_idstringyes
amountnumberyesabove 0

Example input:

{
  "order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a",
  "amount": 4990
}

payment_collection_delete

Delete a payment collection that holds no payment yet.

  • Action key: payment_collection.delete
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: safe to repeat with the same input.
FieldTypeRequiredDescription
payment_collection_idstringyesPayment collection ID from the order

Example input:

{
  "payment_collection_id": "019bb4e4-0993-7733-bdd6-6e58e38f7703"
}

payment_mark_paid

Record an order's payment as received outside the store, e.g. a bank transfer.

Takes the payment collection id from the order (get the order with include payments). Nothing is charged; the payment is only recorded as paid.

  • Action key: payment.mark_paid
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
FieldTypeRequiredDescription
payment_collection_idstringyesPayment collection ID (pay_col_…) from the order
order_idstringyes
provider_idstringPayment provider to record it under

Example input:

{
  "payment_collection_id": "019bb4e4-0993-7733-bdd6-6e58e38f7703",
  "order_id": "019bb3ef-6501-7dc3-a2e7-726e91520b7a"
}

payment_refund

Refund part or all of a captured payment.

Omit amount to refund everything not yet refunded. Amounts are in the payment currency. A dry run reports how much is still refundable without refunding anything; list reasons with refund_reason_list.

  • Action key: payment.refund
  • Permission: orders.refund
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
  • Dry run: supported, with dry_run set to true.
FieldTypeRequiredDescription
payment_idstringyesPayment ID (pay_…)
amountnumberabove 0
refund_reason_idstring
notestringInternal note

Example inputs:

{
  "payment_id": "019bb4b5-6430-7a01-8e17-6df1bfccb8e5"
}
{
  "payment_id": "019bb4b5-6430-7a01-8e17-6df1bfccb8e5",
  "amount": 1200,
  "note": "damaged on arrival"
}

refund_reason_create

Add a reason a refund can be filed under.

  • Action key: refund_reason.create
  • Permission: orders.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: runs at most once; a repeat with the same idempotency key returns the first result.
FieldTypeRequiredDescription
labelstringyesShown in the refund form
codestringyesShort code, e.g. damaged
descriptionstring or null

Example input:

{
  "label": "Damaged on arrival",
  "code": "damaged"
}

refund_reason_delete

Delete a refund reason; refunds already filed under it keep their record.

  • Action key: refund_reason.delete
  • Permission: orders.write
  • Approval: Always waits for a person to approve it.
  • Effect: Changes the live store.
  • Destructive: in compact mode it runs with run_destructive_action.
  • Retries: safe to repeat with the same input.
FieldTypeRequiredDescription
refund_reason_idstringyesRefund reason ID from refund_reason_list

Example input:

{
  "refund_reason_id": "019bb65c-0f78-7003-af13-95ac276a7aeb"
}

refund_reason_update

Change the label, code or description of a refund reason.

  • Action key: refund_reason.update
  • Permission: orders.write
  • Approval: Waits for approval when the store requires it for this action.
  • Effect: Changes the live store.
  • Retries: safe to repeat with the same input.
FieldTypeRequiredDescription
refund_reason_idstringyesRefund reason ID from refund_reason_list
labelstringShown in the refund form
codestringShort code, e.g. damaged
descriptionstring or null

Example input:

{
  "refund_reason_id": "019bb65c-0f78-7003-af13-95ac276a7aeb",
  "label": "Arrived damaged"
}
Last updated