latestSwagger 2.0ShopBase Dev 1.02026-08-10153268547.4 KB

353ccde6240d

Transaction

Creates a transaction for an order.

Creates a transaction for an order.

post/admin/orders/{order_id:(?:\\d+)}/transactions.json

Request body

amountnumber

The amount of money included in the transaction. If you don't provide a value for amount, then it defaults to the total cost of the order (even if a previous transaction has been made towards it).

authorizationstring

The authorization code associated with the transaction.

conversion_ratenumber
created_atstring

The date and time (ISO 8601 format) when the transaction was created.

currencystring

The three-letter code (ISO 4217 format) for the currency used for the payment.

device_idinteger

The ID for the device.

{"stackTrail":"components:schemas:TransactionDto:properties:error_code","oasType":"schema","type":"unknown","description":"A standardized error code, independent of the payment provider."}
gatewaystring

The name of the gateway the transaction was issued through.

idinteger

The ID for the transaction.

kindstring

The transaction's type. Valid values

  • authorization: Money that the customer has agreed to pay. The authorization period can be between 7 and 30 days (depending on your payment service) while a store waits for a payment to be captured.
  • capture: A transfer of money that was reserved during the authorization of a shop.
  • sale: The authorization and capture of a payment performed in one single step.
  • void: The cancellation of a pending authorization or capture.
  • refund: The partial or full return of captured money to the customer.
location_idinteger

The ID of the physical location where the transaction was processed.

messagestring

A string generated by the payment provider with additional information about why the transaction succeeded or failed.

order_idinteger

The ID for the order that the transaction is associated with.

parent_idinteger

The ID of an associated transaction.

processed_atstring

The date and time (ISO 8601 format) when a transaction was processed. This value is the date that's used in the analytic reports. By default, it matches the created_at value. If you're importing transactions from an app or another platform, then you can set processed_at to a date and time in the past to match when the original transaction was processed.

receiptobject

A transaction receipt attached to the transaction by the gateway. The value of this field depends on which gateway the shop is using.

source_namestring

The origin of the transaction. This is set by ShopBase and can't be overridden. Example values: web, pos, iphone, and android.

statusstring

The status of the transaction. Valid values: pending, failure, success, and error

testboolean

Whether the transaction is a test transaction.

transaction_amountnumber

The amount of money included in the payment gateway's transaction.

transaction_currencystring

The three-letter code (ISO 4217 format) for the payment provider's transaction currency used for the payment.

updated_atstring

The date and time (ISO 8601 format) when the transaction was updated.

Example request

{
  "amount": 10,
  "authorization": "ch_1AtJu6CktlpKSclI4zjeQb2t",
  "created_at": "2019-03-13T16:09:54-04:00",
  "currency": "USD",
  "currency_exchange_adjustment": {
    "adjustment": -0.01,
    "currency": "CAD",
    "final_amount": -53.63,
    "id": 1,
    "original_amount": -53.62
  },
  "device_id": 1,
  "gateway": "shopbase_payments",
  "id": 999225661,
  "kind": "capture",
  "location_id": 49202758,
  "message": "Marked the Cash on Delivery (COD) payment as received.",
  "order_id": 450789469,
  "parent_id": 584698724408,
  "payment_details": {
    "avs_result_code": "123456",
    "credit_card_bin": "M",
    "credit_card_company": "Visa",
    "cvv_result_code": "M"
  },
  "processed_at": "2019-05-10T11:00:00-05:00",
  "source_name": "web",
  "status": "success",
  "test": true,
  "updated_at": "2019-03-13T16:09:54-04:00"
}

Response

OK

Example response

{
  "transaction": {
    "amount": 10,
    "authorization": "ch_1AtJu6CktlpKSclI4zjeQb2t",
    "created_at": "2019-03-13T16:09:54-04:00",
    "currency": "USD",
    "currency_exchange_adjustment": {
      "adjustment": -0.01,
      "currency": "CAD",
      "final_amount": -53.63,
      "id": 1,
      "original_amount": -53.62
    },
    "device_id": 1,
    "gateway": "shopbase_payments",
    "id": 999225661,
    "kind": "capture",
    "location_id": 49202758,
    "message": "Marked the Cash on Delivery (COD) payment as received.",
    "order_id": 450789469,
    "parent_id": 584698724408,
    "payment_details": {
      "avs_result_code": "123456",
      "credit_card_bin": "M",
      "credit_card_company": "Visa",
      "cvv_result_code": "M"
    },
    "processed_at": "2019-05-10T11:00:00-05:00",
    "source_name": "web",
    "status": "success",
    "test": true,
    "updated_at": "2019-03-13T16:09:54-04:00"
  }
}