For the complete documentation index, see llms.txt. This page is also available as Markdown.

Place Order

Place orders using the full range of available payment methods (with examples).

post

Create a new orders and collect payments from shoppers using catalog products (products defined in your Control Panel) or dynamic products (products created via API on the fly).

For orders placed with Credit Card, the 3DS Secure flow needs to be covered by redirecting the shoppers to complet the security flow. The full process is detailed here.

For a full list of list of common errors that may arise when using placing order calls via API version 6 here.

When placing a new order it generates unique order reference numbers for all orders (purchases). You can use this parameter RefNo sent in the body to retry authorizations for orders with failed transactions by changing the payment method.

UniToken reuse for card payments: When an order is placed and authorized using a card, the system checks whether a UniToken already exists for that customer (matched on CustomerReference/ExternalCustomerReference plus the card's first 4 and last 4 digits). If a matching UniToken is found, it is updated with the new order reference instead of a new UniToken being generated. The response includes the UniToken field with the ID of the token that was created or updated. Requires the feature to be enabled at account-level. See GET /unitokens/ to retrieve the list of tokens associated with a customer.

Header parameters
X-Avangate-AuthenticationstringRequiredExample: code="{VENDOR_CODE}" date="{REQUEST_DATE_TIME}" hash="{HASH}"
AcceptstringRequiredExample: application/json
Body
LanguagestringOptional
CountrystringOptional
CustomerIPstringOptional
SourcestringOptional
WSOrderstringOptional
ExternalCustomerReferencestringOptional
CurrencystringOptional
Promotionsstring[]Optional
BillingCycleResetbooleanOptional

Only used when the request type is "Place an order with manual renewal". Licence renewal will start immediately upon processing the new order, resetting the billing cycle.

Responses
201

Created

application/json

The order that was created (or updated, for a retry/resume). Field availability can vary slightly by payment method - see the response examples on the operation for the full, method-specific payloads.

RefNostringOptional

Unique order reference number.

Example: 1234567
OrderNointegerOptional
ExternalReferencestringOptional
StatusstringOptional

The status of the order (e.g. AUTHRECEIVED, PENDING, COMPLETE).

ApproveStatusstringOptional
VendorApproveStatusstringOptional
UniTokenstringOptional

The ID of the UniToken associated with this order. Present on orders authorized with a card (directly or via a stored UniToken). If a UniToken already existed for the customer and card (matched on CustomerReference/ExternalCustomerReference plus the card's first 4 and last 4 digits), that same UniToken is updated with this order's reference and returned here instead of a new one being created.

Example: 550e8400-e29b-41d4-a716-446655440000
LanguagestringOptional
SourcestringOptional
WSOrderstringOptional
OrderDatestringOptional
Other propertiesanyOptional
post/orders/
POST /rest/6.0/orders/ HTTP/1.1
Host: api.2checkout.com
X-Avangate-Authentication: code="{VENDOR_CODE}" date="{REQUEST_DATE_TIME}" hash="{HASH}"
Accept: application/json
Content-Type: application/json
Content-Length: 1456

{
  "Country": "us",
  "Currency": "USD",
  "CustomerIP": "91.220.121.21",
  "ExternalReference": "REST_API_AVANGTE",
  "Language": "en",
  "Source": "testAPI.com",
  "WSOrder": "testvendorOrder.com",
  "CheckRenewableProducts": true,
  "Affiliate": {
    "AffiliateCode": "Partner123",
    "AffiliateSource": "MobilePlatform"
  },
  "BillingDetails": {
    "Address1": "Test Address",
    "City": "LA",
    "State": "California",
    "CountryCode": "US",
    "Email": "testcustomer@2Checkout.com",
    "TaxExemptionId": "1b80eecc340e",
    "FirstName": "Customer",
    "LastName": "2Checkout",
    "Zip": "12345"
  },
  "Items": [
    {
      "Name": "Dynamic product",
      "Description": "Test description",
      "Quantity": 1,
      "IsDynamic": true,
      "Tangible": false,
      "Fulfillment": "NO_DELIVERY",
      "PurchaseType": "PRODUCT",
      "CrossSell": {
        "CampaignCode": "CAMPAIGN_CODE",
        "ParentCode": "MASTER_PRODUCT_CODE"
      },
      "Price": {
        "Amount": 100,
        "Type": "CUSTOM"
      },
      "ProductTaxCategoryUUID": "2ad5ecfe-508d-4852-bd24-d400c297523b",
      "PriceType": "GROSS",
      "PriceOptions": [
        {
          "Name": "OPT1",
          "Options": [
            {
              "Name": "Name LR",
              "Value": "Value LR",
              "Surcharge": 7
            }
          ]
        }
      ],
      "RecurringOptions": {
        "CycleLength": 2,
        "CycleUnit": "DAY",
        "CycleAmount": 12.2,
        "ContractLength": 3,
        "ContractUnit": "DAY"
      }
    }
  ],
  "PaymentDetails": {
    "Type": "CC",
    "Currency": "USD",
    "CustomerIP": "91.220.121.21",
    "PaymentMethod": {
      "CardNumber": "4111111111111111",
      "CardType": "VISA",
      "Vendor3DSReturnURL": "www.success.com",
      "Vendor3DSCancelURL": "www.fail.com",
      "ExpirationYear": "2020",
      "ExpirationMonth": "12",
      "CCID": "123",
      "HolderName": "John Doe",
      "RecurringEnabled": true,
      "HolderNameTime": 1,
      "CardNumberTime": 1
    }
  }
}
{
  "RefNo": "11541215",
  "OrderNo": 0,
  "ExternalReference": "REST_API_AVANGTE",
  "Status": "AUTHRECEIVED",
  "ApproveStatus": "WAITING",
  "VendorApproveStatus": "OK",
  "MerchantCode": "120655175030",
  "Language": "en",
  "OrderDate": "2020-03-11 17:33:46",
  "Source": "testAPI.com",
  "WSOrder": "testvendorOrder.com",
  "Affiliate": {},
  "HasShipping": true,
  "ContainsRenewableProducts": true,
  "RequestDeliveryData": true,
  "BillingDetails": {
    "FirstName": "Customer",
    "LastName": "2Checkout",
    "Email": "testcustomer@2Checkout.com",
    "Address1": "Test Address",
    "City": "LA",
    "Zip": "12345",
    "CountryCode": "us",
    "State": "California"
  },
  "DeliveryDetails": {
    "FirstName": "Customer",
    "LastName": "2Checkout",
    "Email": "testcustomer@2Checkout.com",
    "Address1": "Test Address",
    "City": "LA",
    "Zip": "12345",
    "CountryCode": "us",
    "State": "California"
  },
  "PaymentDetails": {
    "Type": "CC",
    "Currency": "usd",
    "PaymentMethod": {
      "FirstDigits": "4111",
      "LastDigits": "1111",
      "CardType": "visa",
      "ExpirationMonth": "12",
      "ExpirationYear": "29",
      "RecurringEnabled": true
    },
    "CustomerIP": "91.220.121.21"
  },
  "DeliveryInformation": {
    "ShippingMethod": {}
  },
  "Origin": "API",
  "AvangateCommission": 8.5,
  "OrderFlow": "REGULAR",
  "TestOrder": false,
  "FxRate": 1,
  "FxMarkup": 0,
  "PayoutCurrency": "USD",
  "DeliveryFinalized": false,
  "Items": [
    {
      "ProductDetails": {
        "Name": "Dynamic product",
        "ShortDescription": "Test description",
        "Tangible": false,
        "IsDynamic": true,
        "Fulfillment": "NO_DELIVERY",
        "RenewalStatus": false,
        "DeliveryInformation": {
          "Delivery": "NO_DELIVERY",
          "DeliveryDescription": "",
          "CodesDescription": "",
          "Codes": []
        }
      },
      "PriceOptions": [],
      "CrossSell": {
        "CampaignCode": "CAMPAIGN_CODE",
        "ParentCode": "MASTER_PRODUCT_CODE"
      },
      "Price": {
        "UnitNetPrice": 100,
        "UnitGrossPrice": 100,
        "UnitVAT": 0,
        "UnitDiscount": 0,
        "UnitNetDiscountedPrice": 100,
        "UnitGrossDiscountedPrice": 100,
        "UnitAffiliateCommission": 0,
        "ItemUnitNetPrice": 0,
        "ItemUnitGrossPrice": 0,
        "ItemNetPrice": 0,
        "ItemGrossPrice": 0,
        "VATPercent": 0,
        "HandlingFeeNetPrice": 0,
        "HandlingFeeGrossPrice": 0,
        "Currency": "usd",
        "NetPrice": 100,
        "GrossPrice": 100,
        "NetDiscountedPrice": 100,
        "GrossDiscountedPrice": 100,
        "Discount": 0,
        "VAT": 0,
        "AffiliateCommission": 0
      },
      "LineItemReference": "1002325206c9e754a019b752b5bf4f103c0f18f1",
      "PurchaseType": "PRODUCT",
      "ExternalReference": "",
      "Quantity": 1,
      "Promotion": {
        "Name": "Regular promotion",
        "Code": "VXVA13JRPM",
        "Description": "description",
        "StartDate": "2022--11-01",
        "EndDate": "2022-11-30",
        "MaximumOrdersNumber": null,
        "MaximumQuantity": null,
        "InstantDiscount": false,
        "Coupon": "",
        "DiscountLabel": "20 EUR",
        "Enabled": true,
        "Type": "REGULAR",
        "Discount": 20,
        "DiscountCurrency": "EUR",
        "DiscountType": "FIXED",
        "Promotions": [
          {
            "Name": "Global promotion",
            "Code": "C03ZALY2S9",
            "Description": "description",
            "StartDate": "2022--11-01",
            "EndDate": "2022-11-30",
            "MaximumOrdersNumber": null,
            "MaximumQuantity": null,
            "InstantDiscount": false,
            "Coupon": "",
            "DiscountLabel": "30",
            "Enabled": true,
            "Type": "GLOBAL",
            "Discount": 30,
            "DiscountCurrency": "USD",
            "DiscountType": "PERCENT"
          },
          {
            "Name": "Order promotion",
            "Code": "SB8ZMIUXZ5",
            "Description": "description",
            "StartDate": "2022--11-01",
            "EndDate": "2022-11-30",
            "MaximumOrdersNumber": null,
            "MaximumQuantity": null,
            "InstantDiscount": false,
            "Coupon": "",
            "DiscountLabel": "45 USD",
            "Enabled": true,
            "Type": "ORDER",
            "Discount": 45,
            "DiscountCurrency": "USD",
            "DiscountType": "FIXED"
          }
        ]
      }
    }
  ],
  "Currency": "usd",
  "NetPrice": 100,
  "GrossPrice": 100,
  "NetDiscountedPrice": 100,
  "GrossDiscountedPrice": 100,
  "Discount": 0,
  "VAT": 0,
  "AffiliateCommission": 0
}

Last updated

Was this helpful?