Skip to main content

Send an Order

Call /v1/order after a customer completes checkout. Pinch records the order, updates the customer's variables, runs the Orders workflow, and returns a decision (ALLOW, DENY, REVIEW) along with the abuse score.

Most fields below are optional in the schema but make Pinch's scoring substantially more accurate. Required for a useful score: order ID, totals, line items, customer email, payment info, and device fingerprint if available.

Request​

POST /v1/order HTTP/1.1
Host: api.pinch.ai
Authorization: {api-key}
Content-Type: application/json

Body​

FieldTypeRequiredDescription
intentstringyesAlways Order for a placed order.
statestringyesOne of PAID, AUTHORIZED, PENDING.
providerCartIdstringnoYour platform's cart identifier.
providerOrderIdstringyesYour platform's order identifier — must be unique.
totalPriceobjectyes{ currencyCode, amount }. Currency is ISO 4217 numeric (840 = USD).
totalTaxesobjectnoSame shape as totalPrice.
totalShippingPriceobjectnoSame shape as totalPrice.
totalDiscountsarraynoArray of { amount }.
lineItemsarrayyesSee lineItems.
customerobjectyesSee customer.
merchantobjectnoSee merchant.
paymentInfoarrayyesSee payment info.
deviceFingerprintsarrayrecommendedSee device fingerprints.
customDataobjectnoFree-form key/value for merchant-specific data.
timestampstringyesEpoch ms as a string.

Line items​

Each entry in lineItems:

FieldTypeRequiredDescription
identifiersarrayyesOne or more { identifierType, identifier }. Identifier types: UPC, EAN, JAN, SKU, SerialNo.
titlestringyesProduct title.
categorystringyesProduct category.
brandstringnoProduct brand.
colourstringnoColor variant.
sizestringnoSize variant.
quantitystringyesQuantity as a string.
unitPriceobjectyes{ currencyCode, amount }.
discountsarraynoArray of discounts applied to this line.

Customer​

FieldTypeRequiredDescription
firstNamestringyes
lastNamestringyes
fullNamestringnoIf provided, takes precedence.
contactInformationarrayyesArray of contact entries.

Each contactInformation entry has a contactType of ContactAddress, EMail, or Phone:

  • ContactAddress — { address: { line1, line2, city, state, postalCode, country, geoCode: { longitude, latitude } }, addressType: "Billing" \| "Shipping" \| "Business" }
  • EMail — { address: "..." }
  • Phone — { number: "+1..." }

At minimum, send one EMail and one ContactAddress of type Billing or Shipping.

Merchant​

FieldTypeDescription
brandstringBrand or store name.
providerMerchantIdstringYour platform's merchant identifier.
locationInfoobjectOptional store location.

Payment info​

Each entry in the paymentInfo array:

FieldTypeDescription
amountobject{ currencyCode, amount }.
instrumentstringe.g. CC-A, DC-A, GiftCard.
last4stringLast 4 digits of the card.
BINstringBank Identification Number.
paymentIdentifierstringYour platform's payment identifier.
postalCodestringBilling postal code on the payment instrument.
methodstringNotPresent, Swipe, Tap, Dip.
authstringAuthorization code.
AIDstringApplication ID (EMV).
giftCardUsedstring"True" or "False".
loyalty_membershipstring"True" or "False".
cvv_result_codestringProcessor CVV result.
avs_result_codestringProcessor AVS result.
paymentStatusstringpre-auth success, captured, etc.
expirystringMM/YY.

Device fingerprints​

[
{ "deviceIdentifier": "{visitorId}" }
]

visitorId comes from the Device JS SDK. Retrieve it from localStorage at checkout and forward to your server, then include it here. Strongly recommended — device signals account for a substantial share of Pinch's scoring.

Example request​

curl https://api.pinch.ai/v1/order \
-H "Authorization: {api-key}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"intent": "Order",
"state": "PAID",
"providerOrderId": "MC229151G",
"totalPrice": { "currencyCode": "840", "amount": "239.0" },
"lineItems": [
{
"identifiers": [{ "identifierType": "UPC", "identifier": "26SDSDSMC30" }],
"title": "Maxi Dress Floral",
"category": "Dress",
"brand": "Demo Brand",
"colour": "blue",
"size": "M",
"quantity": "1",
"unitPrice": { "currencyCode": "840", "amount": "239.0" },
"discounts": []
}
],
"customer": {
"firstName": "John",
"lastName": "Doe",
"fullName": "John Doe",
"contactInformation": [
{ "contactType": "EMail", "address": "johndoe@example.com" },
{
"contactType": "ContactAddress",
"address": {
"line1": "1234 Main St",
"city": "San Francisco",
"state": "CA",
"postalCode": "94101",
"country": "US"
},
"addressType": "Shipping"
}
]
},
"paymentInfo": [
{
"amount": { "currencyCode": "840", "amount": "239.0" },
"instrument": "CC-A",
"last4": "4532",
"BIN": "282739",
"postalCode": "94101",
"method": "NotPresent",
"paymentStatus": "pre-auth success",
"expiry": "04/27"
}
],
"deviceFingerprints": [{ "deviceIdentifier": "abc123visitorId" }],
"timestamp": "1720791715000"
}'

Response​

{
"providerOrderID": "MC229151G",
"pinchOrderID": "pin_8c2f9a1b",
"cartLevelDecisions": [
{
"providerCartID": "54154079438549",
"pinchCartID": "pcart_1f9d",
"decisions": [
{
"decisionType": "APPROVE/DECLINE",
"decision": "APPROVE",
"subDecision": "Default Approve",
"decisionReason": "No risk signals detected",
"abuseScore": 12
}
]
}
]
}
FieldDescription
providerOrderIDEcho of your providerOrderId.
pinchOrderIDPinch's internal order identifier.
cartLevelDecisions[].decisions[].decisionAPPROVE, DECLINE, or REVIEW.
cartLevelDecisions[].decisions[].subDecisionThe specific branch that matched in your workflow.
cartLevelDecisions[].decisions[].decisionReasonHuman-readable explainer.
cartLevelDecisions[].decisions[].abuseScore0–100 abuse risk score.

Errors​

See Errors for the full error envelope. Common error codes for this endpoint:

HTTPCodeMeaning
400invalid_requestMissing required field or malformed JSON.
401unauthenticatedAPI key missing or invalid.
409duplicate_orderproviderOrderId already exists for this merchant.
422unprocessable_entityField values failed validation (e.g. unknown currency code).
429rate_limitedSlow down.
500internal_errorRetry with exponential backoff.

Idempotency​

Pinch treats providerOrderId as the idempotency key. Retrying the same providerOrderId returns the original decision rather than creating a duplicate. See Conventions for more.

See also​

  • Returns API — submit a return for the same order
  • Decisions — what decision and subDecision mean