Skip to main content

create_order Method

Overview

The create_order method initializes a payment order at the processor before collecting payment details. This enables improved fraud detection and session tokens for wallet payments.

Business Use Case: Set up the payment infrastructure before checkout, or when integrating wallet payments that require a session token.

Purpose

ScenarioBenefit
Wallet paymentsSession token for Apple/Google Pay
Pre-checkoutPrepare payment context early
Risk assessmentAllow processor fraud checks

Request Fields

FieldTypeRequiredDescription
merchant_order_idstrYesYour unique order reference
amountMoneyYesExpected payment amount
webhook_urlstrNoURL for notifications
test_modeboolNoProcess as test transaction

Response Fields

FieldTypeDescription
merchant_order_idstrYour reference
connector_order_idstrConnector's order ID
statusPaymentStatusSTARTED, FAILED
session_tokendictSession data for wallets
status_codeintHTTP status code

Example

SDK Setup

from orchestratorx_prism import PaymentClient

payment_client = PaymentClient(
connector='stripe',
api_key='YOUR_API_KEY',
environment='SANDBOX'
)

Request

request = {
"merchant_order_id": "order_001",
"amount": {
"minor_amount": 1000,
"currency": "USD"
},
"webhook_url": "https://your-app.com/webhooks/stripe",
"test_mode": True
}

response = await payment_client.create_order(request)

Response

{
"merchant_order_id": "order_001",
"connector_order_id": "pi_3Oxxx...",
"status": "STARTED",
"session_token": {
"client_secret": "pi_3Oxxx..._secret_xxx"
},
"status_code": 200
}

Next Steps

  • authorize - Create payment with order context