Skip to content
POST

Charge a customer token to create an order

https://api.kustom.co/customer-token/v1/tokens/{customerToken}/order

Charges the customer’s stored payment method for the given order and, on success, forwards the resulting order to Order Manager. Internally served by MerchantApiController’s /merchant/{merchantId}/v1/tokens/{tokenId}/order route, reached through MerchantRequestRewriteFilter. Merchant log action: CHARGE_TOKEN.

Parameters1 field
  • customerTokenstringrequiredin path
Request body53 fields
  • attachmentobjectoptional
    2 fields in attachment
    • bodystringrequired

      Extra merchant data (EMD), serialized to JSON and passed through as a string.

    • content_typestringrequired

      The content type of the body.

  • auto_capturebooleanoptional

    Allow merchant to trigger auto capturing.

  • merchant_datastringoptional

    Pass through field (max 6000 characters).

  • merchant_reference1stringoptional

    Merchant’s internal order number or other reference. Shown on the confirmation page as “order number” if set (max 255 characters).

  • merchant_reference2stringoptional
  • merchant_urlsobjectoptional
    2 fields in merchant_urls
    • confirmationstringrequired

      URL of merchant confirmation page (max 2000 characters).

    • pushstringoptional

      URL that will be requested when an order is completed. Should be different than checkout and confirmation URLs (max 2000 characters).

  • order_amountinteger · int64required

    Non-negative minor units. Total amount of the order, including tax and discounts.

  • order_lines[]array<object>required
    24 fields in order_lines
    • image_urlstringoptional
    • merchant_datastringoptional

      Pass through field (max 255 characters).

    • namestringrequired

      Descriptive name of the order line item.

    • product_identifiersobjectoptional
      6 fields in product_identifiers
      • brandstringoptional
      • category_pathstringoptional
      • global_trade_item_numberstringoptional
      • manufacturer_part_numberstringoptional
      • colorstringoptional
      • sizestringoptional
    • product_urlstringoptional
    • quantityinteger · int64required

      Quantity of the order line item.

    • quantity_unitstringoptional
    • referencestringoptional
    • tax_rateinteger · int64optional

      Non-negative. Two implicit decimals, e.g. 1900 = 19%.

    • total_amountinteger · int64required

      Non-negative minor units, includes tax and discount. value = (quantity x unit_price) - total_discount_amount.

    • total_discount_amountinteger · int64optional

      Non-negative minor units, includes tax.

    • total_tax_amountinteger · int64optional

      Total tax amount of the order line. Negative when type is discount.

    • typestringoptional
      • physical
      • discount
      • shipping_fee
      • sales_tax
      • digital
      • gift_card
      • store_credit
      • surcharge
    • unit_priceinteger · int64required

      Non-negative minor units, includes tax, excludes discount.

    • subscriptionobjectoptional
      3 fields in subscription
      • namestringrequired

        The name of the subscription product.

      • intervalstringrequired

        The cadence unit for this subscription.

        • DAY
        • WEEK
        • MONTH
        • YEAR
      • interval_countintegerrequired

        The number of intervals.

  • order_tax_amountinteger · int64optional

    Non-negative minor units. The total tax amount of the order.

  • purchase_currencystringrequired

    ISO 4217 purchase currency.

  • shipping_addressobjectoptional
    13 fields in shipping_address
    • attentionstringoptional

      ‘Attn.’ - optional parameter.

    • citystringoptional

      Customer’s city.

    • countrystringoptional

      Customer’s country. Should follow ISO 3166 alpha-2, e.g. GB, US, DE, SE.

    • emailstringoptional

      Customer’s email address.

    • family_namestringoptional

      Customer’s family name.

    • given_namestringoptional

      Customer’s first name.

    • organization_namestringoptional

      Organization name (if applicable). Only applicable for B2B customers.

    • phonestringoptional

      Phone number. Preferably a mobile phone number.

    • postal_codestringoptional

      Customer’s postal code.

    • regionstringoptional

      Customer’s region or state. Mandatory for US and AU market. ISO 3166-2 format.

    • street_addressstringoptional

      Customer’s street address.

    • street_address2stringoptional

      Customer’s street address, second line.

    • titlestringoptional

      Customer’s title.

  • usagestringoptional
200
Response7 fields

Order was successfully created.

  • authorized_payment_methodobjectoptional
    3 fields in authorized_payment_method
    • number_of_daysinteger · int32optional
    • number_of_installmentsinteger · int32optional
    • typestringrequired
      • invoice
      • fixed_amount
      • pix
      • base_account
      • deferred_interest
      • direct_debit
      • direct_bank_transfer
      • b2b_invoice
      • card
      • slice_it_by_card
      • pay_later_by_card
      • fixed_sum_credit
      • +2 more
  • fraud_statusstringrequired

    Always ACCEPTED for token charges.

  • order_idstringrequired

    Unique order ID of the transaction.

  • redirect_urlstringoptional

    URL to redirect the customer to after placing the order, taken from the request’s merchant_urls.confirmation.

400
Response9 fields

The request failed validation, the token is not active, the token has no email on file, or the merchant is not configured for recurring payments.

  • authorized_payment_methodobjectoptional
    3 fields in authorized_payment_method
    • number_of_daysinteger · int32optional
    • number_of_installmentsinteger · int32optional
    • typestringrequired
      • invoice
      • fixed_amount
      • pix
      • base_account
      • deferred_interest
      • direct_debit
      • direct_bank_transfer
      • b2b_invoice
      • card
      • slice_it_by_card
      • pay_later_by_card
      • fixed_sum_credit
      • +2 more
  • correlation_idstringoptional
  • error_codestringoptional
  • error_messages[]array<string>optional
  • fraud_statusstringoptional
  • reasonstringoptional
403
Response9 fields

The charge attempt was declined by the payment provider.

  • authorized_payment_methodobjectoptional
    3 fields in authorized_payment_method
    • number_of_daysinteger · int32optional
    • number_of_installmentsinteger · int32optional
    • typestringrequired
      • invoice
      • fixed_amount
      • pix
      • base_account
      • deferred_interest
      • direct_debit
      • direct_bank_transfer
      • b2b_invoice
      • card
      • slice_it_by_card
      • pay_later_by_card
      • fixed_sum_credit
      • +2 more
  • correlation_idstringoptional
  • error_codestringoptional
  • error_messages[]array<string>optional
  • fraud_statusstringoptional
  • reasonstringoptional
404
Response0 fields

The merchant is not migrated, or the token or merchant was not found.

No response body — this status returns headers only.

500
Response0 fields

An unexpected error occurred.

No response body — this status returns headers only.

This page is also available as Markdown — append .md to its URL — and is indexed in llms.txt.