Skip to main content

Cancel a Transaction

POST 

https://useast.api.elasticpath.com/v2/orders/:orderID/transactions/:transactionID/cancel

Use this endpoint to cancel or void a pending or authorized transaction. The transaction can be canceled or voided when it is in pending and completed statuses.

caution

This endpoint works only for Stripe and PayPal and does not work for manual gateway.

Request

Path Parameters

    orderID stringrequired

    The unique identifier of the order.

    transactionID stringrequired

    The unique identifier of the transaction to be canceled or voided.

Body

    data object
    optionsobject
    reasonstring

    Specifies the reason for canceling the transaction. The reason may include duplicate, fraudulent, requested_by_customer, or abandoned.

Responses

Response Headers
    Schema
      data object
      iduuid

      The ID of the transaction.

      referencestring

      The payment gateway reference.

      namestring

      A custom name associated with the payment method.

      custom_referencestring

      A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend you not to include personal information in this field.

      gatewaystring

      The name of the payment gateway used.

      Possible values: [adyen, authorize_net, braintree, card_connect, cyber_source, elastic_path_payments_stripe, manual, paypal_express_checkout, stripe, stripe_connect, stripe_payment_intents]

      amountnumber

      The amount for this transaction.

      refunded_amountnumber

      The refunded amount.

      currencystring

      The transaction currency.

      transaction-typestring

      The type of transaction, such as purchase, capture, authorize or refund.

      statusstring

      The status provided by the gateway for this transaction, such as complete or failed.

      relationships object
      order object
      data object
      typestring

      Represents the type of the object being returned. It is always order.

      iduuid

      The ID of the order.

      meta object
      display_price object
      amountnumber

      The raw total of this cart.

      currencystring

      The currency set for this cart.

      formattedstring

      The tax inclusive formatted total based on the currency.

      display_refunded_amount object
      amountnumber

      The raw total of this cart.

      currencystring

      The currency set for this cart.

      formattedstring

      The tax inclusive formatted total based on the currency.

      timestamps object
      created_atstring

      The date this was created.

      updated_at

      The date this was last updated.

    Authorization: http

    name: bearerAuthtype: httpscheme: bearer
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, "https://useast.api.elasticpath.com/v2/orders/:orderID/transactions/:transactionID/cancel");
    request.Headers.Add("Accept", "application/json");
    request.Headers.Add("Authorization", "Bearer <token>");
    var content = new StringContent("{\n \"data\": {\n \"options\": {},\n \"reason\": \"string\"\n }\n}", null, "application/json");
    request.Content = content;
    var response = await client.SendAsync(request);
    response.EnsureSuccessStatusCode();
    Console.WriteLine(await response.Content.ReadAsStringAsync());
    Request Collapse all
    Base URL
    https://useast.api.elasticpath.com
    Auth
    Parameters
    — pathrequired
    — pathrequired
    Body
    {
      "data": {
        "options": {},
        "reason": "string"
      }
    }
    
    ResponseClear

    Click the Send API Request button above and see the response here!