0

we are seeing a big dependency between the order ID that we are getting from Magento via REST and the order ID that we see in the order confirmation email. for example REST returns 45, the email has 200045646.

We implemented the increment features directly into the SQL database based on some posts here but it seems that REST APIs pull the original non incremented order ID. anyone was able to address this issue ?

We are using Magento as a backend an d talking to it via REST API

2
  • This is increment_id= 200045646, not I'd, id=45
    – user52581
    Commented Apr 18, 2017 at 8:12
  • The question is how do we pull increment_id so we can display it on the app for the user after order has been placed. and have that ID match the ID they receive in the email , which is 200045646 for example
    – Fodakty
    Commented Apr 18, 2017 at 8:18

1 Answer 1

0

When you place an order, Magento will reserve/assign an increment_id for the order_id.

The increment_id is generated thanks to the primary autoincrement key of this table : sequence_order_1. Where 1 is the store_id.

So the increment_id and the order_id is not the same value.

The increment_id is the ID displayed for the customer.

In order to retrieve the increment_id from API, you can retrieve order information with the order_id such as :

get /V1/orders/{order_id}

Response format :

Usefull information here : incrementId

{
  "adjustmentNegative": 0,
  "adjustmentPositive": 0,
  "appliedRuleIds": "string",
  "baseAdjustmentNegative": 0,
  "baseAdjustmentPositive": 0,
  "baseCurrencyCode": "string",
  "baseDiscountAmount": 0,
  "baseDiscountCanceled": 0,
  "baseDiscountInvoiced": 0,
  "baseDiscountRefunded": 0,
  "baseGrandTotal": 0,
  "baseDiscountTaxCompensationAmount": 0,
  "baseDiscountTaxCompensationInvoiced": 0,
  "baseDiscountTaxCompensationRefunded": 0,
  "baseShippingAmount": 0,
  "baseShippingCanceled": 0,
  "baseShippingDiscountAmount": 0,
  "baseShippingDiscountTaxCompensationAmnt": 0,
  "baseShippingInclTax": 0,
  "baseShippingInvoiced": 0,
  "baseShippingRefunded": 0,
  "baseShippingTaxAmount": 0,
  "baseShippingTaxRefunded": 0,
  "baseSubtotal": 0,
  "baseSubtotalCanceled": 0,
  "baseSubtotalInclTax": 0,
  "baseSubtotalInvoiced": 0,
  "baseSubtotalRefunded": 0,
  "baseTaxAmount": 0,
  "baseTaxCanceled": 0,
  "baseTaxInvoiced": 0,
  "baseTaxRefunded": 0,
  "baseTotalCanceled": 0,
  "baseTotalDue": 0,
  "baseTotalInvoiced": 0,
  "baseTotalInvoicedCost": 0,
  "baseTotalOfflineRefunded": 0,
  "baseTotalOnlineRefunded": 0,
  "baseTotalPaid": 0,
  "baseTotalQtyOrdered": 0,
  "baseTotalRefunded": 0,
  "baseToGlobalRate": 0,
  "baseToOrderRate": 0,
  "billingAddressId": 0,
  "canShipPartially": 0,
  "canShipPartiallyItem": 0,
  "couponCode": "string",
  "createdAt": "string",
  "customerDob": "string",
  "customerEmail": "string",
  "customerFirstname": "string",
  "customerGender": 0,
  "customerGroupId": 0,
  "customerId": 0,
  "customerIsGuest": 0,
  "customerLastname": "string",
  "customerMiddlename": "string",
  "customerNote": "string",
  "customerNoteNotify": 0,
  "customerPrefix": "string",
  "customerSuffix": "string",
  "customerTaxvat": "string",
  "discountAmount": 0,
  "discountCanceled": 0,
  "discountDescription": "string",
  "discountInvoiced": 0,
  "discountRefunded": 0,
  "editIncrement": 0,
  "emailSent": 0,
  "entityId": 0,
  "extCustomerId": "string",
  "extOrderId": "string",
  "forcedShipmentWithInvoice": 0,
  "globalCurrencyCode": "string",
  "grandTotal": 0,
  "discountTaxCompensationAmount": 0,
  "discountTaxCompensationInvoiced": 0,
  "discountTaxCompensationRefunded": 0,
  "holdBeforeState": "string",
  "holdBeforeStatus": "string",
  "incrementId": "string",
  "isVirtual": 0,
  "orderCurrencyCode": "string",
  "originalIncrementId": "string",
  "paymentAuthorizationAmount": 0,
  "paymentAuthExpiration": 0,
  "protectCode": "string",
  "quoteAddressId": 0,
  "quoteId": 0,
  "relationChildId": "string",
  "relationChildRealId": "string",
  "relationParentId": "string",
  "relationParentRealId": "string",
  "remoteIp": "string",
  "shippingAmount": 0,
  "shippingCanceled": 0,
  "shippingDescription": "string",
  "shippingDiscountAmount": 0,
  "shippingDiscountTaxCompensationAmount": 0,
  "shippingInclTax": 0,
  "shippingInvoiced": 0,
  "shippingRefunded": 0,
  "shippingTaxAmount": 0,
  "shippingTaxRefunded": 0,
  "state": "string",
  "status": "string",
  "storeCurrencyCode": "string",
  "storeId": 0,
  "storeName": "string",
  "storeToBaseRate": 0,
  "storeToOrderRate": 0,
  "subtotal": 0,
  "subtotalCanceled": 0,
  "subtotalInclTax": 0,
  "subtotalInvoiced": 0,
  "subtotalRefunded": 0,
  "taxAmount": 0,
  "taxCanceled": 0,
  "taxInvoiced": 0,
  "taxRefunded": 0,
  "totalCanceled": 0,
  "totalDue": 0,
  "totalInvoiced": 0,
  "totalItemCount": 0,
  "totalOfflineRefunded": 0,
  "totalOnlineRefunded": 0,
  "totalPaid": 0,
  "totalQtyOrdered": 0,
  "totalRefunded": 0,
  "updatedAt": "string",
  "weight": 0,
  "xForwardedFor": "string",
  "items": [
    {
      "additionalData": "string",
      "amountRefunded": 0,
      "appliedRuleIds": "string",
      "baseAmountRefunded": 0,
      "baseCost": 0,
      "baseDiscountAmount": 0,
      "baseDiscountInvoiced": 0,
      "baseDiscountRefunded": 0,
      "baseDiscountTaxCompensationAmount": 0,
      "baseDiscountTaxCompensationInvoiced": 0,
      "baseDiscountTaxCompensationRefunded": 0,
      "baseOriginalPrice": 0,
      "basePrice": 0,
      "basePriceInclTax": 0,
      "baseRowInvoiced": 0,
      "baseRowTotal": 0,
      "baseRowTotalInclTax": 0,
      "baseTaxAmount": 0,
      "baseTaxBeforeDiscount": 0,
      "baseTaxInvoiced": 0,
      "baseTaxRefunded": 0,
      "baseWeeeTaxAppliedAmount": 0,
      "baseWeeeTaxAppliedRowAmnt": 0,
      "baseWeeeTaxDisposition": 0,
      "baseWeeeTaxRowDisposition": 0,
      "createdAt": "string",
      "description": "string",
      "discountAmount": 0,
      "discountInvoiced": 0,
      "discountPercent": 0,
      "discountRefunded": 0,
      "eventId": 0,
      "extOrderItemId": "string",
      "freeShipping": 0,
      "gwBasePrice": 0,
      "gwBasePriceInvoiced": 0,
      "gwBasePriceRefunded": 0,
      "gwBaseTaxAmount": 0,
      "gwBaseTaxAmountInvoiced": 0,
      "gwBaseTaxAmountRefunded": 0,
      "gwId": 0,
      "gwPrice": 0,
      "gwPriceInvoiced": 0,
      "gwPriceRefunded": 0,
      "gwTaxAmount": 0,
      "gwTaxAmountInvoiced": 0,
      "gwTaxAmountRefunded": 0,
      "discountTaxCompensationAmount": 0,
      "discountTaxCompensationCanceled": 0,
      "discountTaxCompensationInvoiced": 0,
      "discountTaxCompensationRefunded": 0,
      "isQtyDecimal": 0,
      "isVirtual": 0,
      "itemId": 0,
      "lockedDoInvoice": 0,
      "lockedDoShip": 0,
      "name": "string",
      "noDiscount": 0,
      "orderId": 0,
      "originalPrice": 0,
      "parentItemId": 0,
      "price": 0,
      "priceInclTax": 0,
      "productId": 0,
      "productType": "string",
      "qtyBackordered": 0,
      "qtyCanceled": 0,
      "qtyInvoiced": 0,
      "qtyOrdered": 0,
      "qtyRefunded": 0,
      "qtyReturned": 0,
      "qtyShipped": 0,
      "quoteItemId": 0,
      "rowInvoiced": 0,
      "rowTotal": 0,
      "rowTotalInclTax": 0,
      "rowWeight": 0,
      "sku": "string",
      "storeId": 0,
      "taxAmount": 0,
      "taxBeforeDiscount": 0,
      "taxCanceled": 0,
      "taxInvoiced": 0,
      "taxPercent": 0,
      "taxRefunded": 0,
      "updatedAt": "string",
      "weeeTaxApplied": "string",
      "weeeTaxAppliedAmount": 0,
      "weeeTaxAppliedRowAmount": 0,
      "weeeTaxDisposition": 0,
      "weeeTaxRowDisposition": 0,
      "weight": 0,
      "parentItem": {},
      "productOption": {
        "extensionAttributes": {
          "customOptions": [
            {
              "optionId": "string",
              "optionValue": "string",
              "extensionAttributes": {
                "fileInfo": {
                  "base64EncodedData": "string",
                  "type": "string",
                  "name": "string"
                }
              }
            }
          ],
          "downloadableOption": {
            "downloadableLinks": [
              0
            ]
          },
          "giftcardItemOption": {
            "giftcardAmount": 0,
            "customGiftcardAmount": 0,
            "giftcardSenderName": "string",
            "giftcardRecipientName": "string",
            "giftcardSenderEmail": "string",
            "giftcardRecipientEmail": "string",
            "giftcardMessage": "string",
            "extensionAttributes": {}
          },
          "configurableItemOptions": [
            {
              "optionId": "string",
              "optionValue": 0,
              "extensionAttributes": {}
            }
          ],
          "bundleOptions": [
            {
              "optionId": 0,
              "optionQty": 0,
              "optionSelections": [
                0
              ],
              "extensionAttributes": {}
            }
          ]
        }
      },
      "extensionAttributes": {
        "giftMessage": {
          "giftMessageId": 0,
          "customerId": 0,
          "sender": "string",
          "recipient": "string",
          "message": "string",
          "extensionAttributes": {
            "entityId": "string",
            "entityType": "string",
            "wrappingId": 0,
            "wrappingAllowGiftReceipt": true,
            "wrappingAddPrintedCard": true
          }
        }
      }
    }
  ],
  "billingAddress": {
    "addressType": "string",
    "city": "string",
    "company": "string",
    "countryId": "string",
    "customerAddressId": 0,
    "customerId": 0,
    "email": "string",
    "entityId": 0,
    "fax": "string",
    "firstname": "string",
    "lastname": "string",
    "middlename": "string",
    "parentId": 0,
    "postcode": "string",
    "prefix": "string",
    "region": "string",
    "regionCode": "string",
    "regionId": 0,
    "street": [
      "string"
    ],
    "suffix": "string",
    "telephone": "string",
    "vatId": "string",
    "vatIsValid": 0,
    "vatRequestDate": "string",
    "vatRequestId": "string",
    "vatRequestSuccess": 0,
    "extensionAttributes": {}
  },
  "payment": {
    "accountStatus": "string",
    "additionalData": "string",
    "additionalInformation": [
      "string"
    ],
    "addressStatus": "string",
    "amountAuthorized": 0,
    "amountCanceled": 0,
    "amountOrdered": 0,
    "amountPaid": 0,
    "amountRefunded": 0,
    "anetTransMethod": "string",
    "baseAmountAuthorized": 0,
    "baseAmountCanceled": 0,
    "baseAmountOrdered": 0,
    "baseAmountPaid": 0,
    "baseAmountPaidOnline": 0,
    "baseAmountRefunded": 0,
    "baseAmountRefundedOnline": 0,
    "baseShippingAmount": 0,
    "baseShippingCaptured": 0,
    "baseShippingRefunded": 0,
    "ccApproval": "string",
    "ccAvsStatus": "string",
    "ccCidStatus": "string",
    "ccDebugRequestBody": "string",
    "ccDebugResponseBody": "string",
    "ccDebugResponseSerialized": "string",
    "ccExpMonth": "string",
    "ccExpYear": "string",
    "ccLast4": "string",
    "ccNumberEnc": "string",
    "ccOwner": "string",
    "ccSecureVerify": "string",
    "ccSsIssue": "string",
    "ccSsStartMonth": "string",
    "ccSsStartYear": "string",
    "ccStatus": "string",
    "ccStatusDescription": "string",
    "ccTransId": "string",
    "ccType": "string",
    "echeckAccountName": "string",
    "echeckAccountType": "string",
    "echeckBankName": "string",
    "echeckRoutingNumber": "string",
    "echeckType": "string",
    "entityId": 0,
    "lastTransId": "string",
    "method": "string",
    "parentId": 0,
    "poNumber": "string",
    "protectionEligibility": "string",
    "quotePaymentId": 0,
    "shippingAmount": 0,
    "shippingCaptured": 0,
    "shippingRefunded": 0,
    "extensionAttributes": {}
  },
  "statusHistories": [
    {
      "comment": "string",
      "createdAt": "string",
      "entityId": 0,
      "entityName": "string",
      "isCustomerNotified": 0,
      "isVisibleOnFront": 0,
      "parentId": 0,
      "status": "string",
      "extensionAttributes": {}
    }
  ],
  "extensionAttributes": {
    "shippingAssignments": [
      {
        "shipping": {
          "address": {
            "addressType": "string",
            "city": "string",
            "company": "string",
            "countryId": "string",
            "customerAddressId": 0,
            "customerId": 0,
            "email": "string",
            "entityId": 0,
            "fax": "string",
            "firstname": "string",
            "lastname": "string",
            "middlename": "string",
            "parentId": 0,
            "postcode": "string",
            "prefix": "string",
            "region": "string",
            "regionCode": "string",
            "regionId": 0,
            "street": [
              "string"
            ],
            "suffix": "string",
            "telephone": "string",
            "vatId": "string",
            "vatIsValid": 0,
            "vatRequestDate": "string",
            "vatRequestId": "string",
            "vatRequestSuccess": 0,
            "extensionAttributes": {}
          },
          "method": "string",
          "total": {
            "baseShippingAmount": 0,
            "baseShippingCanceled": 0,
            "baseShippingDiscountAmount": 0,
            "baseShippingDiscountTaxCompensationAmnt": 0,
            "baseShippingInclTax": 0,
            "baseShippingInvoiced": 0,
            "baseShippingRefunded": 0,
            "baseShippingTaxAmount": 0,
            "baseShippingTaxRefunded": 0,
            "shippingAmount": 0,
            "shippingCanceled": 0,
            "shippingDiscountAmount": 0,
            "shippingDiscountTaxCompensationAmount": 0,
            "shippingInclTax": 0,
            "shippingInvoiced": 0,
            "shippingRefunded": 0,
            "shippingTaxAmount": 0,
            "shippingTaxRefunded": 0,
            "extensionAttributes": {}
          },
          "extensionAttributes": {}
        },
        "items": [
          {
            "additionalData": "string",
            "amountRefunded": 0,
            "appliedRuleIds": "string",
            "baseAmountRefunded": 0,
            "baseCost": 0,
            "baseDiscountAmount": 0,
            "baseDiscountInvoiced": 0,
            "baseDiscountRefunded": 0,
            "baseDiscountTaxCompensationAmount": 0,
            "baseDiscountTaxCompensationInvoiced": 0,
            "baseDiscountTaxCompensationRefunded": 0,
            "baseOriginalPrice": 0,
            "basePrice": 0,
            "basePriceInclTax": 0,
            "baseRowInvoiced": 0,
            "baseRowTotal": 0,
            "baseRowTotalInclTax": 0,
            "baseTaxAmount": 0,
            "baseTaxBeforeDiscount": 0,
            "baseTaxInvoiced": 0,
            "baseTaxRefunded": 0,
            "baseWeeeTaxAppliedAmount": 0,
            "baseWeeeTaxAppliedRowAmnt": 0,
            "baseWeeeTaxDisposition": 0,
            "baseWeeeTaxRowDisposition": 0,
            "createdAt": "string",
            "description": "string",
            "discountAmount": 0,
            "discountInvoiced": 0,
            "discountPercent": 0,
            "discountRefunded": 0,
            "eventId": 0,
            "extOrderItemId": "string",
            "freeShipping": 0,
            "gwBasePrice": 0,
            "gwBasePriceInvoiced": 0,
            "gwBasePriceRefunded": 0,
            "gwBaseTaxAmount": 0,
            "gwBaseTaxAmountInvoiced": 0,
            "gwBaseTaxAmountRefunded": 0,
            "gwId": 0,
            "gwPrice": 0,
            "gwPriceInvoiced": 0,
            "gwPriceRefunded": 0,
            "gwTaxAmount": 0,
            "gwTaxAmountInvoiced": 0,
            "gwTaxAmountRefunded": 0,
            "discountTaxCompensationAmount": 0,
            "discountTaxCompensationCanceled": 0,
            "discountTaxCompensationInvoiced": 0,
            "discountTaxCompensationRefunded": 0,
            "isQtyDecimal": 0,
            "isVirtual": 0,
            "itemId": 0,
            "lockedDoInvoice": 0,
            "lockedDoShip": 0,
            "name": "string",
            "noDiscount": 0,
            "orderId": 0,
            "originalPrice": 0,
            "parentItemId": 0,
            "price": 0,
            "priceInclTax": 0,
            "productId": 0,
            "productType": "string",
            "qtyBackordered": 0,
            "qtyCanceled": 0,
            "qtyInvoiced": 0,
            "qtyOrdered": 0,
            "qtyRefunded": 0,
            "qtyReturned": 0,
            "qtyShipped": 0,
            "quoteItemId": 0,
            "rowInvoiced": 0,
            "rowTotal": 0,
            "rowTotalInclTax": 0,
            "rowWeight": 0,
            "sku": "string",
            "storeId": 0,
            "taxAmount": 0,
            "taxBeforeDiscount": 0,
            "taxCanceled": 0,
            "taxInvoiced": 0,
            "taxPercent": 0,
            "taxRefunded": 0,
            "updatedAt": "string",
            "weeeTaxApplied": "string",
            "weeeTaxAppliedAmount": 0,
            "weeeTaxAppliedRowAmount": 0,
            "weeeTaxDisposition": 0,
            "weeeTaxRowDisposition": 0,
            "weight": 0,
            "parentItem": {},
            "productOption": {
              "extensionAttributes": {
                "customOptions": [
                  {
                    "optionId": "string",
                    "optionValue": "string",
                    "extensionAttributes": {
                      "fileInfo": {
                        "base64EncodedData": "string",
                        "type": "string",
                        "name": "string"
                      }
                    }
                  }
                ],
                "downloadableOption": {
                  "downloadableLinks": [
                    0
                  ]
                },
                "giftcardItemOption": {
                  "giftcardAmount": 0,
                  "customGiftcardAmount": 0,
                  "giftcardSenderName": "string",
                  "giftcardRecipientName": "string",
                  "giftcardSenderEmail": "string",
                  "giftcardRecipientEmail": "string",
                  "giftcardMessage": "string",
                  "extensionAttributes": {}
                },
                "configurableItemOptions": [
                  {
                    "optionId": "string",
                    "optionValue": 0,
                    "extensionAttributes": {}
                  }
                ],
                "bundleOptions": [
                  {
                    "optionId": 0,
                    "optionQty": 0,
                    "optionSelections": [
                      0
                    ],
                    "extensionAttributes": {}
                  }
                ]
              }
            },
            "extensionAttributes": {
              "giftMessage": {
                "giftMessageId": 0,
                "customerId": 0,
                "sender": "string",
                "recipient": "string",
                "message": "string",
                "extensionAttributes": {
                  "entityId": "string",
                  "entityType": "string",
                  "wrappingId": 0,
                  "wrappingAllowGiftReceipt": true,
                  "wrappingAddPrintedCard": true
                }
              }
            }
          }
        ],
        "stockId": 0,
        "extensionAttributes": {}
      }
    ],
    "appliedTaxes": [
      {
        "code": "string",
        "title": "string",
        "percent": 0,
        "amount": 0,
        "baseAmount": 0,
        "extensionAttributes": {}
      }
    ],
    "itemAppliedTaxes": [
      {
        "type": "string",
        "itemId": 0,
        "associatedItemId": 0,
        "appliedTaxes": [
          {
            "code": "string",
            "title": "string",
            "percent": 0,
            "amount": 0,
            "baseAmount": 0,
            "extensionAttributes": {}
          }
        ],
        "extensionAttributes": {}
      }
    ],
    "convertingFromQuote": true,
    "giftMessage": {
      "giftMessageId": 0,
      "customerId": 0,
      "sender": "string",
      "recipient": "string",
      "message": "string",
      "extensionAttributes": {
        "entityId": "string",
        "entityType": "string",
        "wrappingId": 0,
        "wrappingAllowGiftReceipt": true,
        "wrappingAddPrintedCard": true
      }
    },
    "gwId": "string",
    "gwAllowGiftReceipt": "string",
    "gwAddCard": "string",
    "gwPrice": "string",
    "gwBasePrice": "string",
    "gwItemsPrice": "string",
    "gwItemsBasePrice": "string",
    "gwCardPrice": "string",
    "gwCardBasePrice": "string",
    "gwBaseTaxAmount": "string",
    "gwTaxAmount": "string",
    "gwItemsBaseTaxAmount": "string",
    "gwItemsTaxAmount": "string",
    "gwCardBaseTaxAmount": "string",
    "gwCardTaxAmount": "string",
    "gwPriceInclTax": "string",
    "gwBasePriceInclTax": "string",
    "gwCardPriceInclTax": "string",
    "gwCardBasePriceInclTax": "string",
    "gwItemsPriceInclTax": "string",
    "gwItemsBasePriceInclTax": "string"
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.