# POST /orders

## POST /orders

> Creates an order ---- \[auth scope:  api-user]

```json
{"openapi":"3.0.0","info":{"title":"Merchant API","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"CreateOrderDto":{"type":"object","properties":{"orderReference":{"type":"string","description":"Your unique order reference to use for identifying an order. This must be unique per merchant. This reference will be returned in order status responses and webhook notifications, allowing you to correlate API responses with your internal order records."},"bnplProvider":{"type":"string","description":"The APM provider to place the order against. This value must be one of the providers returned from the GET /options endpoint. The provider determines which payment service will process the transaction.","enum":["KLARNA","KLARNA_US","KLARNA_AU","KLARNA_NZ","KLARNA_3_INSTALMENTS","CLEARPAY","AFTERPAY_AU","OPENPAY_AU","ZIP_UK","ZIP_NZ","ZIP_AU","ZIP_SG","OPENPAY_UK","LAYBUY_NZ","LAYBUY_UK","LAYBUY_AU","PAYFLEX_SA","SPLITIT","HOOLAH_SG","HOOLAH_MY","HOOLAH_HK","QUADPAY_US","QUADPAY_CA","OPENPAY_NZ","AFTERPAY_NZ","AFTERPAY_US","AFTERPAY_CA","SEZZLE","AFFIRM_US","AFFIRM_CAD","LATITUDEPAY_AU","SPOTII","PAGANTIS_EU","ALMA","SCALAPAY","TENDOPAY","ATOME","ATOME_TW","ATOME_TH","ATOME_ID","ATOME_MY","ATOME_HK","ATOME_VN","ATOME_PH","RELY_SG","GRAB_SG","GRAB_MY","SOFINCO_X3CB","SOFINCO_X4CB","BILLEASE_PH","HUMM_AU","HUMM_NZ","HUMM_UK","HUMM_IE","PACE","SMARTPAY","PAYPAL","TABBY_AE","TABBY_SA","TABBY_QA","TABBY_KW","TABBY_BH","GENOAPAY","POSTPAY","REAL_SOLUTION_DIRECT_DEBIT","REAL_SOLUTION_OPEN_INVOICE","CLEOPAY","ERATY","ALIPAY_US","ALIPAY_CN","ALIPAY_HK","ALIPAY_PH","ALIPAY_MY","ALIPAY_TH","ALIPAY_ID","ALIPAY_BD","ABLR_MY","ABLR_SG","SHOPBACK_SG","SHOPBACK_MY","BNPP","LATITUDE_IF_AU","LATITUDE_IF_AU_DEFERRED","LATITUDE_IF_AU_DEFFERED","APLAZO_MX","PAYJUSTNOW_SA","TRIPLEA","MPGS","PAYSQUAD_NZ","WAAVE","TAMARA_SA","TAMARA_AE","VALU","PAYTAB","MYFATOORAH_KW","GOCARDLESS","GOCARDLESS_GB","GOCARDLESS_EU","GOCARDLESS_AU","GOCARDLESS_NZ","PAYMOB_EG","CASHEW","MONOOVA_AU","VOLT","LATITUDEPAY_SG","LATITUDEPAY_MY","LINK_US","AZUPAY_AU","AIRWALLEX_AU","ZIP_CA","PLANPAY_AU","RAZORPAY_IN","VOLT_AU","SANDBOX_PAYMENT_METHOD","SANDBOX_PAYMENT_METHOD_V2","IRIS_A2A_EUR","ADYEN_PAYPO_PL","UATP","COINSPAID","COINSPAID_EU","COINSPAID_GB","RAZORPAY_UPI_IN","MYFATOORAH_SA","PAYSAFE_SKRILL_EU","PAYSAFE_NETELLER_EU","PAYSAFECARD_EU","VOLT_BR","TRUSTLY_EU","TRUSTLY_NL","UNIONPAY_CN","KOMOJU","PAYPAY_JPY","PAYEASY_JP","KONBINI_JP","AUPAY_JP","BITCASH_JP","MERPAY_JP","NET_CASH_JP","KOMOJU_BANK_TRANSFER_JP","KOMOJU_CREDIT_CARD_JP","PAIDY_JP","RAKUTENPAY_JP","WEBMONEY_JP","ALIPAY_JP","MYBANK_EU","WECHATPAY_JP","KAKAOPAY_KR","TOUCH_N_GO_MY","GCASH_PHP","DANA_JP","GRABPAY_SG","TOSS_KR","DRAGONPAY_PH","PRZELEWY24_PL","PAYCO_KR","OVO_ID","PAYSAFE_CARD_EUR","LINEPAY_JP","KOREA_CREDIT_CARDS_KR","EPS_EU","PIX_BR","MULTIBANCO_EU","FPX_MY","HAPPY_MONEY_KR","DOKU_ID","CULTURE_VOUCHER_KR","BRAZIL_CREDIT_CARDS_BR","BANCONTACT_BE","BLIK_PL","FISERV_CARDS_AU","FAT_ZEBRA_AU","CREDITEA_MX","RIVERTY_INVOICE_DE","RIVERTY_INVOICE_NL","RIVERTY_PAYIN3_NL","RIVERTY_FIXED_INSTALLMENTS_DE","DLOCAL_SN","DLOCAL_CI","DLOCAL_OPAY_NG","DLOCAL_PAGA_WALLET_NG","FAT_ZEBRA_AU_3DS","KLARNA_MX","KLARNA_CA","KLARNA_HU","KLARNA_RO","KLARNA_PL","KLARNA_CZ","CONTACT_EG","SOUHOOLA_EG","ZIP_US","AFFIRM_GB","SHOPEEPAY","SHOPEEPAY_SG","SPLITITV3","VISA_CYBERSOURCE_CARD","ALIPAY_PLUS","ALIPAY_PLUS_TOUCH_N_GO_MY","PAYU_IN","HELLO_CLEVER_AU","ALIPAY_PLUS_CN","ONEY_4X_FR","ALIPAY_PLUS_GCASH_PH","PAYJUSTNOW_ZA_V2","ALIPAY_PLUS_TRUEMONEY_TH","ALIPAY_PLUS_DANA_JP","HUMM_CA","ALIPAY_PLUS_KAKAOPAY_KR","ALIPAY_PLUS_TOSS_KR","ALIPAY_PLUS_BOOST_MY","ALIPAY_PLUS_NAVERPAY_KR","ALIPAY_PLUS_AKULAKU_ID","ALIPAY_PLUS_RABBIT_LINE_PAY_TH","ALIPAY_PLUS_AKULAKU_PH","ALIPAY_PLUS_BILLEASE_PH","ALIPAY_PLUS_BPI_PH","ALIPAY_PLUS_KREDIVO_ID","ALIPAY_PLUS_MPAY_CN","ALIPAY_PLUS_MPAY_MO","WORLDPAY_CARDS","NUAPAY_GB","NUAPAY_EU","KNET_MYFATOORAH_KW","PAYBY_AE","STRIPE_CARDS","STRIPE","NUVEI_CARDS_AU","ANTOM_GCASH_PH","GOCARDLESS_US","ANTOM","PAYSQUAD","LATITUDE_IF_NZ","VISA_CYBERSOURCE_CARD_AU","ANTOM_PAY_NOW_SG","ANTOM_FAMI_PAY_JP","ANTOM_ALIPAY_HK","ANTOM_IDEAL_EU","ANTOM_BOOST_MY","ANTOM_PROMPT_PAY","ANTOM_KPLUS_TH","ANTOM_MAYA_PH","ANTOM_MERCADO_PAGO","ANTOM_MOMO","VIPPS_MOBILEPAY_NO","ANTOM_PIX","ANTOM_KAKAO_PAY","DLOCAL_KE","DLOCAL_BOOST_MY","DLOCAL_OVO_ID","DLOCAL_TOUCH_N_GO_MY","DLOCAL_FPX_MY","DLOCAL_DUITNOWQR_MY","DLOCAL_GRABPAY_PH","ANTOM_ALIPAY_CN","VIPPS_MOBILEPAY_DK","FLOOSS_BH","VIPPS_MOBILEPAY_FI","PAYU_UPI_IN","IRIS_PAY_GR","DLOCAL_DANA_ID","DLOCAL_SHOPEEPAY_ID","DLOCAL_SHOPEEPAY_MY","DLOCAL_LINKAJA_ID","DLOCAL_MAYBANK_MY","DLOCAL_QRIS_ID","DLOCAL_MAYA_PH","DLOCAL_SHOPEEPAY_PH","DLOCAL_ALFA_PK","DLOCAL_JAZZCASH_PK","DLOCAL_WALLETS_IN","DLOCAL_EASYPAISA_PK","DLOCAL_GCASH_PH","DLOCAL_UPI_IN","DLOCAL_NETBANKING_IN","DLOCAL_VALU_EG","DLOCAL_PIX_BR","AIRWALLEX_US","AIRWALLEX_GB","AIRWALLEX_EU","SPRING_GB","SPRING_GOOGLE_PAY_GB"]},"purchaseCountry":{"type":"string","description":"The country code the purchase is originating from. Must be in ISO 3166 alpha-2 format."},"purchaseCurrency":{"type":"string","description":"The currency the purchase is being made in. Must be in ISO 4217 format. The currency must be supported by the selected payment provider in the GET /options endpoint."},"locale":{"type":"string","description":"The locale for the order, used to determine language and regional formatting on the checkout page. Should be in RFC 1766 standard format."},"shippingAmount":{"type":"number","description":"The shipping cost for the order. Must be a non-negative number with up to 2 decimal places. If not provided, defaults to 0.","minimum":0},"discountAmount":{"type":"number","description":"The total discount amount applied to the order. Must be a non-negative number with up to 2 decimal places. Can be used for promotional discounts, coupon codes, or other price reductions.","minimum":0},"taxAmount":{"type":"number","description":"The total tax amount for the order. Must be a non-negative number with up to 2 decimal places. This is included in the order amount.","minimum":0},"orderAmount":{"type":"number","description":"The total order amount, including tax, shipping, and discounts. Must equal the sum of all order item total amounts plus shipping and tax, minus any discount. Formula: orderAmount = sum(orderItems.totalAmount) + shippingAmount + taxAmount - discountAmount. Must be a non-negative number with up to 2 decimal places.","minimum":0},"orderItems":{"description":"A list of items included in the order. Each item must have a name, SKU, quantity, unit price, and total amount. The total amount for each item must equal the product of unit price and quantity (totalAmount = unitPrice × quantity). At least one item is required.","type":"array","items":{"$ref":"#/components/schemas/OrderItem"}},"customer":{"description":"Information about the customer placing the order. Includes name, email, and phone number. Required for payment processing and order fulfillment.","allOf":[{"$ref":"#/components/schemas/OrderCustomer"}]},"billingAddress":{"description":"The customer's billing address. Required for payment processing and address verification. These values are conditionally mandatory based on the selected payment provider, the GET /options endpoint outlines these requirements.","allOf":[{"$ref":"#/components/schemas/BillingAddress"}]},"shippingAddress":{"description":"The customer's shipping address.","allOf":[{"$ref":"#/components/schemas/BillingAddress"}]},"shippingType":{"type":"string","description":"The shipping type for this order.","enum":["normal","express"]},"shippingMethod":{"type":"string","description":"The shipping method for this order. Indicates how the order will be delivered. Use \"digital\" for digital products or services that do not require physical shipping. Use \"delivery\" for standard home delivery, \"pick-up\" for store pickup, \"store\" for in-store purchases, etc.","enum":["store","delivery","digital","pick-up","registered","unregistered"]},"autoCapture":{"type":"boolean","description":"Determines if payment should be automatically captured immediately after authorization. If false, the payment will need to be captured manually later using the capture endpoint. Defaults to True."},"additionalData":{"type":"object","description":"Additional metadata or configuration data specific to the APM provider. This is a flexible object that can contain provider-specific fields and values."},"dynamicRedirectUrl":{"type":"string","description":"A custom URL to redirect the customer to after payment is completed. Must be a valid HTTPS URL. The customer will be redirected to this URL after completing payment, regardless of whether the payment was successful, declined, pending, canceled. You should handle all possible payment statuses on this page."},"dynamicCallbackUrl":{"type":"string","description":"A custom webhook URL to receive payment status updates for ORDER_ASYNC_CALLBACK events. Must be a valid HTTPS URL. This endpoint will receive asynchronous notifications when the order status changes to a final state (SUCCESSFUL, DECLINED, CANCELED, ERROR). Always handle PENDING status on initial response and wait for webhook notifications for final status."},"cancellationTimeout":{"type":"number","description":"The timeout in seconds from order creation after which an unpaid order will be automatically cancelled by the system. After this timeout expires, the order status will change to CANCELED with cancelledBy set to \"SYSTEM\" and we will cancel the checkout with the APM provider. You will receive an ORDER_ASYNC_CALLBACK webhook notification when this occurs.","minimum":0},"partnerConfiguration":{"type":"object","description":"Partner-specific configuration settings. This object can contain custom configuration parameters required by specific partners or integrations."},"getToken":{"type":"boolean","description":"Set to true to generate a payment token returned in the webhook notification when the order reaches a successful status. This token can be used for future merchant-initiated payments using the 'token' field without requiring the customer to re-enter payment details. The token will be included in the ORDER_ASYNC_CALLBACK webhook notification."},"token":{"type":"string","description":"A previously obtained payment token to use for merchant-initiated repeat payments. This allows processing a payment without requiring the customer to re-enter their payment details. The token must have been obtained from a previous transaction with getToken set to true. When using a token, you must also set customerPresent to indicate whether the customer is physically present during the transaction. It is then unnessecary to redirect a customer to the redirectUrl as the payment will be completed immediately."},"customerPresent":{"type":"boolean","description":"Indicates whether the customer is physically present during the transaction. Required when using token-based payments for merchant-initiated transactions. This is to confirm the merchant initiated transaction is compliant with the selected APM provider and token."},"channel":{"type":"string","description":"Channel alias identifier, should be the same channel alias passed in this order flows GET /options call."},"sessionId":{"type":"string","description":"The unique session identifier for the payment session. Must be a valid UUID. Used to track and link multiple requests within the same payment session."},"partnerOrderReference":{"type":"string","description":"A reference number or identifier provided by the partner or third-party system (grandparent or parent). Used for tracking and reconciliation purposes between systems."},"checkoutSessionTimeout":{"type":"number","description":"The timeout duration in seconds starting AFTER a customer has completed the checkout process. After this time, the order will be canceled if it has remained in a PENDING state. This is different from cancellationTimeout - checkoutSessionTimeout begins when the customer completes checkout process, while cancellationTimeout begins when the order is created.","minimum":0},"isActivatedViaOAuth":{"type":"boolean","description":"Tells if the provider is activated by oAuth or apiKey/ password "}},"required":["orderReference","bnplProvider","purchaseCountry","purchaseCurrency","locale","orderAmount","orderItems","customer","billingAddress","customerPresent","isActivatedViaOAuth"]},"OrderItem":{"type":"object","properties":{"name":{"type":"string","description":"The name of the order item. This may be displayed to the customer by the APM provider."},"imageUrl":{"type":"string","description":"The URL of the product image. Must be a valid HTTPS URL. This may be displayed to the customer by the APM provider."},"sku":{"type":"string","description":"The Stock Keeping Unit (SKU) or product code that uniquely identifies this item."},"quantity":{"type":"number","description":"The quantity of this item being ordered. Must be a non-negative integer.","minimum":0},"unitPrice":{"type":"number","description":"The price per unit of this item. Must be a number with up to 2 decimal places. Can be negative for discount line items."},"totalAmount":{"type":"number","description":"The total cost for this item line (unit price × quantity). Must be a number with up to 2 decimal places. Can be negative for discount line items. Must equal the product of unit price and quantity."},"type":{"type":"string","description":"If the item is a flight or hotel, this will be set to the type of item. This is to help the APM provider identify the item type and apply any relevant rules or constraints.","enum":["Flights","Hotel"]},"departureDate":{"type":"string","description":"The departure date for flight items. Required when item type is \"flight\". Should be in ISO 8601 date format (YYYY-MM-DD)."},"flightNumber":{"type":"string","description":"The flight number for flight items. Required when item type is \"flight\". Typically includes airline code and flight number."},"origin":{"type":"string","description":"The origin airport or city code for flight items. Required when item type is \"flight\". Typically uses IATA airport codes (e.g., LHR, JFK)."},"destination":{"type":"string","description":"The destination airport or city code for flight items. Required when item type is \"flight\". Typically uses IATA airport codes (e.g., JFK, LAX)."},"title":{"type":"string","description":"An optional title or short description for the order item. Can be used to provide additional context or categorization."},"unitAmount":{"type":"number","description":"The amount per unit before tax and discounts. Used for detailed breakdown of item pricing. Must be a number with up to 2 decimal places."},"unitTaxAmount":{"type":"number","description":"The tax amount per unit. Used for detailed tax breakdown. Must be a number with up to 2 decimal places."},"unitDiscountAmount":{"type":"number","description":"The discount amount per unit. Used for detailed discount breakdown. Must be a number with up to 2 decimal places."},"tripType":{"type":"string","description":"Trip type for flight items only","enum":["OneWay","Return","MultipleDestination","Unknown","Null"]}},"required":["name","imageUrl","sku","quantity","unitPrice","totalAmount","type","departureDate","flightNumber","origin","destination","title","unitAmount","unitTaxAmount","unitDiscountAmount","tripType"]},"OrderCustomer":{"type":"object","properties":{"firstName":{"type":"string","description":"The customer's first name. Required for payment processing and order fulfillment. Used for customer identification and communication."},"lastName":{"type":"string","description":"The customer's last name (surname). Required for payment processing and order fulfillment. Used for customer identification and communication."},"email":{"type":"string","description":"The customer's email address. Must be a valid email format. Required for order confirmation, payment notifications, and customer communication."},"phoneNumber":{"type":"string","description":"The customer's phone number. Should include country code for international numbers. Used for order updates, delivery notifications, and customer verification."}},"required":["firstName","lastName","email","phoneNumber"]},"BillingAddress":{"type":"object","properties":{"title":{"type":"string","description":"The customer's title or honorific (e.g., Mr, Mrs, Ms, Dr). Used for formal address formatting."},"firstName":{"type":"string","description":"The customer's first name for the billing address."},"lastName":{"type":"string","description":"The customer's last name (surname) for the billing address."},"phoneNumber":{"type":"string","description":"The customer's phone number for the billing address."},"email":{"type":"string","description":"The customer's email address for the billing address."},"streetAddress":{"type":"string","description":"The first line of the billing address (street address and number)."},"streetAddress2":{"type":"string","description":"The second line of the billing address (apartment number, suite, building, etc.)."},"city":{"type":"string","description":"The city or town of the billing address."},"state":{"type":"string","description":"The state, province, or region of the billing address."},"country":{"type":"string","description":"The country of the billing address. Must be in ISO 3166 alpha-2 format."},"region":{"type":"string","description":"The region or administrative area of the billing address. Used for additional address classification. In ISO 3166 format."},"postalCode":{"type":"string","description":"The postal code or ZIP code of the billing address."}},"required":["title","firstName","lastName","phoneNumber","email","streetAddress","city","state","country","region","postalCode"]},"OrderWithMetadataResponse":{"type":"object","properties":{"orderId":{"type":"string","description":"The unique identifier of the order generated by Optty. This is a UUID that uniquely identifies the order in Optty's system."},"orderToken":{"type":"string","description":"The order token returned from the APM provider. This token is used by the payment provider to identify the order."},"redirectUrl":{"type":"string","description":"The redirect URL provided by the APM provider where the customer should be redirected to complete payment. For merchant-initiated payments using tokens, this URL will redirect back to dynamicRedirectURL with payment status, allowing reuse of existing status page for customer present merchant initiated transactions. The customer should be redirected to this URL to complete the payment process."},"bnplProvider":{"type":"string","description":"The APM provider that is processing this order. This matches the bnplProvider value that was sent in the create order request.","enum":["KLARNA","KLARNA_US","KLARNA_AU","KLARNA_NZ","KLARNA_3_INSTALMENTS","CLEARPAY","AFTERPAY_AU","OPENPAY_AU","ZIP_UK","ZIP_NZ","ZIP_AU","ZIP_SG","OPENPAY_UK","LAYBUY_NZ","LAYBUY_UK","LAYBUY_AU","PAYFLEX_SA","SPLITIT","HOOLAH_SG","HOOLAH_MY","HOOLAH_HK","QUADPAY_US","QUADPAY_CA","OPENPAY_NZ","AFTERPAY_NZ","AFTERPAY_US","AFTERPAY_CA","SEZZLE","AFFIRM_US","AFFIRM_CAD","LATITUDEPAY_AU","SPOTII","PAGANTIS_EU","ALMA","SCALAPAY","TENDOPAY","ATOME","ATOME_TW","ATOME_TH","ATOME_ID","ATOME_MY","ATOME_HK","ATOME_VN","ATOME_PH","RELY_SG","GRAB_SG","GRAB_MY","SOFINCO_X3CB","SOFINCO_X4CB","BILLEASE_PH","HUMM_AU","HUMM_NZ","HUMM_UK","HUMM_IE","PACE","SMARTPAY","PAYPAL","TABBY_AE","TABBY_SA","TABBY_QA","TABBY_KW","TABBY_BH","GENOAPAY","POSTPAY","REAL_SOLUTION_DIRECT_DEBIT","REAL_SOLUTION_OPEN_INVOICE","CLEOPAY","ERATY","ALIPAY_US","ALIPAY_CN","ALIPAY_HK","ALIPAY_PH","ALIPAY_MY","ALIPAY_TH","ALIPAY_ID","ALIPAY_BD","ABLR_MY","ABLR_SG","SHOPBACK_SG","SHOPBACK_MY","BNPP","LATITUDE_IF_AU","LATITUDE_IF_AU_DEFERRED","LATITUDE_IF_AU_DEFFERED","APLAZO_MX","PAYJUSTNOW_SA","TRIPLEA","MPGS","PAYSQUAD_NZ","WAAVE","TAMARA_SA","TAMARA_AE","VALU","PAYTAB","MYFATOORAH_KW","GOCARDLESS","GOCARDLESS_GB","GOCARDLESS_EU","GOCARDLESS_AU","GOCARDLESS_NZ","PAYMOB_EG","CASHEW","MONOOVA_AU","VOLT","LATITUDEPAY_SG","LATITUDEPAY_MY","LINK_US","AZUPAY_AU","AIRWALLEX_AU","ZIP_CA","PLANPAY_AU","RAZORPAY_IN","VOLT_AU","SANDBOX_PAYMENT_METHOD","SANDBOX_PAYMENT_METHOD_V2","IRIS_A2A_EUR","ADYEN_PAYPO_PL","UATP","COINSPAID","COINSPAID_EU","COINSPAID_GB","RAZORPAY_UPI_IN","MYFATOORAH_SA","PAYSAFE_SKRILL_EU","PAYSAFE_NETELLER_EU","PAYSAFECARD_EU","VOLT_BR","TRUSTLY_EU","TRUSTLY_NL","UNIONPAY_CN","KOMOJU","PAYPAY_JPY","PAYEASY_JP","KONBINI_JP","AUPAY_JP","BITCASH_JP","MERPAY_JP","NET_CASH_JP","KOMOJU_BANK_TRANSFER_JP","KOMOJU_CREDIT_CARD_JP","PAIDY_JP","RAKUTENPAY_JP","WEBMONEY_JP","ALIPAY_JP","MYBANK_EU","WECHATPAY_JP","KAKAOPAY_KR","TOUCH_N_GO_MY","GCASH_PHP","DANA_JP","GRABPAY_SG","TOSS_KR","DRAGONPAY_PH","PRZELEWY24_PL","PAYCO_KR","OVO_ID","PAYSAFE_CARD_EUR","LINEPAY_JP","KOREA_CREDIT_CARDS_KR","EPS_EU","PIX_BR","MULTIBANCO_EU","FPX_MY","HAPPY_MONEY_KR","DOKU_ID","CULTURE_VOUCHER_KR","BRAZIL_CREDIT_CARDS_BR","BANCONTACT_BE","BLIK_PL","FISERV_CARDS_AU","FAT_ZEBRA_AU","CREDITEA_MX","RIVERTY_INVOICE_DE","RIVERTY_INVOICE_NL","RIVERTY_PAYIN3_NL","RIVERTY_FIXED_INSTALLMENTS_DE","DLOCAL_SN","DLOCAL_CI","DLOCAL_OPAY_NG","DLOCAL_PAGA_WALLET_NG","FAT_ZEBRA_AU_3DS","KLARNA_MX","KLARNA_CA","KLARNA_HU","KLARNA_RO","KLARNA_PL","KLARNA_CZ","CONTACT_EG","SOUHOOLA_EG","ZIP_US","AFFIRM_GB","SHOPEEPAY","SHOPEEPAY_SG","SPLITITV3","VISA_CYBERSOURCE_CARD","ALIPAY_PLUS","ALIPAY_PLUS_TOUCH_N_GO_MY","PAYU_IN","HELLO_CLEVER_AU","ALIPAY_PLUS_CN","ONEY_4X_FR","ALIPAY_PLUS_GCASH_PH","PAYJUSTNOW_ZA_V2","ALIPAY_PLUS_TRUEMONEY_TH","ALIPAY_PLUS_DANA_JP","HUMM_CA","ALIPAY_PLUS_KAKAOPAY_KR","ALIPAY_PLUS_TOSS_KR","ALIPAY_PLUS_BOOST_MY","ALIPAY_PLUS_NAVERPAY_KR","ALIPAY_PLUS_AKULAKU_ID","ALIPAY_PLUS_RABBIT_LINE_PAY_TH","ALIPAY_PLUS_AKULAKU_PH","ALIPAY_PLUS_BILLEASE_PH","ALIPAY_PLUS_BPI_PH","ALIPAY_PLUS_KREDIVO_ID","ALIPAY_PLUS_MPAY_CN","ALIPAY_PLUS_MPAY_MO","WORLDPAY_CARDS","NUAPAY_GB","NUAPAY_EU","KNET_MYFATOORAH_KW","PAYBY_AE","STRIPE_CARDS","STRIPE","NUVEI_CARDS_AU","ANTOM_GCASH_PH","GOCARDLESS_US","ANTOM","PAYSQUAD","LATITUDE_IF_NZ","VISA_CYBERSOURCE_CARD_AU","ANTOM_PAY_NOW_SG","ANTOM_FAMI_PAY_JP","ANTOM_ALIPAY_HK","ANTOM_IDEAL_EU","ANTOM_BOOST_MY","ANTOM_PROMPT_PAY","ANTOM_KPLUS_TH","ANTOM_MAYA_PH","ANTOM_MERCADO_PAGO","ANTOM_MOMO","VIPPS_MOBILEPAY_NO","ANTOM_PIX","ANTOM_KAKAO_PAY","DLOCAL_KE","DLOCAL_BOOST_MY","DLOCAL_OVO_ID","DLOCAL_TOUCH_N_GO_MY","DLOCAL_FPX_MY","DLOCAL_DUITNOWQR_MY","DLOCAL_GRABPAY_PH","ANTOM_ALIPAY_CN","VIPPS_MOBILEPAY_DK","FLOOSS_BH","VIPPS_MOBILEPAY_FI","PAYU_UPI_IN","IRIS_PAY_GR","DLOCAL_DANA_ID","DLOCAL_SHOPEEPAY_ID","DLOCAL_SHOPEEPAY_MY","DLOCAL_LINKAJA_ID","DLOCAL_MAYBANK_MY","DLOCAL_QRIS_ID","DLOCAL_MAYA_PH","DLOCAL_SHOPEEPAY_PH","DLOCAL_ALFA_PK","DLOCAL_JAZZCASH_PK","DLOCAL_WALLETS_IN","DLOCAL_EASYPAISA_PK","DLOCAL_GCASH_PH","DLOCAL_UPI_IN","DLOCAL_NETBANKING_IN","DLOCAL_VALU_EG","DLOCAL_PIX_BR","AIRWALLEX_US","AIRWALLEX_GB","AIRWALLEX_EU","SPRING_GB","SPRING_GOOGLE_PAY_GB"]},"orderReference":{"type":"string","description":"The order reference that was submitted when creating the order. This is your unique identifier for the order that you provided in the create order request. Use this reference to track and correlate the order with your internal systems."},"orderAmount":{"type":"number","description":"The total order amount, including tax, shipping, and discounts. This matches the orderAmount value that was sent in the create order request. The amount is in the currency specified in purchaseCurrency."},"orderPaymentOption":{"type":"string","description":"A human-readable description of the type of the payment method selected for the order (e.g., \"buy now pay later\", \"debit/credit\", \"digital wallet\")."},"orderDate":{"format":"date-time","type":"string","description":"The date and time when the order was created. This is in ISO 8601 format (UTC)."},"paymentStatus":{"type":"string","description":"The current payment status of the order (SUCCESSFUL, CANCELLED, DECLINED, PENDING). Always handle PENDING status on initial response and wait for webhook notifications for final status updates."},"transactionReference":{"type":"string","description":"A non UUID transaction reference generated by Optty for this order."},"surcharge":{"type":"number","description":"The surcharge fee charged to the customer for using this payment method. This amount is added to the order total and is configured in the Universal Payment Platform (UPP). If no surcharge is configured, this field will be 0."},"bnplLateFeeText":{"type":"string","description":"Custom text configured by the merchant regarding late fees for this payment provider. Display this text to inform customers about potential late payment fees. This text is configured in the Universal Payment Platform UPP by the merchant."},"bnplCustomerFeeText":{"type":"string","description":"Custom text configured by the merchant regarding processing fees for this payment provider. Display this text to inform customers about any processing fees they may incur and ensure they have accepted the fee. This text is configured in the UPP."}},"required":["orderId","orderToken","bnplProvider","orderReference","orderAmount","orderPaymentOption","orderDate","paymentStatus","transactionReference"]},"BadRequestResponse":{"type":"object","properties":{"statusCode":{"type":"number","description":"statusCode"},"message":{"type":"string","description":"message"}},"required":["statusCode","message"]},"UnauthorizedResponse":{"type":"object","properties":{"statusCode":{"type":"number","description":"statusCode"},"message":{"type":"string","description":"message"}},"required":["statusCode","message"]},"NotFoundResponse":{"type":"object","properties":{"statusCode":{"type":"number","description":"statusCode"},"message":{"type":"string","description":"message"}},"required":["statusCode","message"]}}},"paths":{"/orders":{"post":{"operationId":"OrdersController_postOrders","summary":"Creates an order ---- [auth scope:  api-user]","deprecated":false,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderWithMetadataResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}},"tags":["orders"]}}}}
```

## Sample Request/Response

{% tabs %}
{% tab title="Sample Request" %}

```javascript
{
   "bnplProvider":"LATITUDEPAY_AU",
   "locale":"en_AU",
   "customerToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lcklkZW50aWZpZXIiOiI5OWIwODI1MDA4OTUxMDNjMmNjNTNiZmNhMGVlZTNjOTdjMjE2MGM4ZGFhMGM0MmQ4NmI3M2M4NWU5NjA0NTE5ZGEzMDI4MWE3MjlhYzYwMWZjYzMyZDc4ZTdjZmQ1NmJkMjllNjIwZTI2YWU0ZTYzYTRjZTVlOTc2NWE2ZjA3NCIsIm1lcmNoYW50SWQiOiJkNmJiZmQ5Zi02OWZhLTQ3MjgtOTU0YS04MWU0NWI4YWFkMmQiLCJpYXQiOjE2MDE2NjAwMTUsImV4cCI6MTYwMTY2MzYxNX0.Y0UKdtSNPVnJlLN3Xv53Y1_o2AbLPhjxJ1P5O0DSpnE",
   "orderReference":"LP000_OrderID",
   "orderAmount":144.89,
   "taxAmount":6.9,
   "shippingAmount":7.99,
   "discountAmount":0,
   "purchaseCountry":"AU",
   "purchaseCurrency":"AUD",
   "orderItems":[
      {
         "name":"Optty Striped Dress Shirt",
         "quantity":1,
         "sku":"69309284M-1",
         "unitPrice":130,
         "totalAmount":130
      }
   ],
   "customer":{
      "firstName":"Your FirstName",
      "lastName":"Your LastName",
      "email":"test@test.test",
      "phoneNumber":"(415) 200-0000"
   },
   "billingAddress":{
      "firstName":"Your FirstName",
      "lastName":"Your LastName",
      "email":"test@test.test",
      "phoneNumber":"(415) 200-0000",
      "streetAddress":"Your Address",
      "streetAddress2":"Your Address2",
      "city":"Sydney",
      "country":"AU",
      "region":"Oceanian",
      "postalCode":"2000",
      "state": "NSW"
   }
   "shippingAddress":{
      "firstName":"Your FirstName",
      "lastName":"Your LastName",
      "email":"test@test.test",
      "phoneNumber":"(415) 200-0000",
      "streetAddress":"Your Address",
      "streetAddress2":"Your Address2",
      "city":"Sydney",
      "country":"AU",
      "region":"Oceanian",
      "postalCode":"2000",
      "state": "NSW"
   }
   "shippingType": "normal",
   "shippingMethod": "store pick-up",
   "dynamicRedirectUrl": "YOUR_URL",
   "dynamicCallbackUrl": "YOUR_URL",
   "cancellationTimeout": 2880
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="200 Order Created." %}

```javascript
{
    "orderId": "LP000429e48ec-f6e3-49d2-bd38-8e1408d025c8",
    "orderToken": "5d47c4a0-9bfc-406d-9da1-bbc61202c722",
    "redirectUrl": "https://app.uat.latitudepay.com/r/NVXIFQBC",
    "bnplProvider": "LATITUDEPAY_AU",
    "orderReference": "LP000429e48ec-f6e3-49d2-bd38-8e1408d025c8",
    "orderAmount": 144.89,
    "orderPaymentOption": "buy now pay later",
    "orderDate": "2021-10-07T14:30:36.166Z",
    "paymentStatus": "pending",
    "transactionReference": "40ca337c3b"
}
```

{% endtab %}

{% tab title="400 Check the Data fields or Value that you sent to Optty" %}

```javascript
{
    "statusCode": 400,
    "message": [
        "billingAddress.country must be a valid ISO31661 Alpha2 code"
    ],
    "error": "Bad Request"
}

//OR

{
    "statusCode": 400,
    "message": "Unexpected token / in JSON at position 1333",
    "error": "Bad Request"
}


```

{% endtab %}

{% tab title="401 Check your credentials and accessToken / Environment live or Staging. " %}

```javascript
{
    "statusCode": 401,
    "message": "Unauthorized"
}
```

{% endtab %}

{% tab title="404 Check if you're in the correct endpoint for the API call. " %}

```javascript
{
    "statusCode": 404,
    "message": "Cannot POST /orders/a",
    "error": "Not Found"
}
```

{% endtab %}

{% tab title="500 Try a different BNPL if that works, or contact <support@optty.com>  for further investigation" %}

```javascript
{
    "statusCode": 500,
    "message": "Internal server error"
}
```

{% endtab %}
{% endtabs %}
