Skip to main content

πŸ’³ Payment Service

The Payment Service handles the full payment lifecycleβ€”from order creation and customer details to payment capture and verification. It supports multiple payment flows, tracks authorization, and integrates refund and settlement URLs.


🧾 Order Structure​

Order​

FieldTypeDescription
idstring/ObjectIDInternal unique identifier
order_idstringPublic-facing order ID
order_amountfloat64Total amount for the order
order_currencystringCurrency (e.g., INR, USD)
customer_detailsCustomerDetailsCustomer info (name, email, phone, ID)
order_metaOrderMetaReturn/notify URLs and payment method metadata
order_expiry_timetimestampWhen the order becomes invalid
order_notestringOptional notes for order
order_statusstringStatus of the order (e.g., created, paid, failed)
order_tagsOrderTagsOptional categorization tags
order_createdtimestampWhen the order was created
payment_session_idstringUnique ID used for initiating payment
paymentsPaymentsURL reference to payment resource
refundsRefundsURL reference to refund resource
settlementsSettlementsURL reference to settlement resource

πŸ‘€ CustomerDetails​

FieldTypeDescription
customer_iduint32Customer ID in the system
org_iduint32Associated organization ID
customer_namestringFull name
customer_emailstringEmail address
customer_phonestringMobile number

🌐 OrderMeta​

FieldTypeDescription
return_urlstringRedirect after payment
notify_urlstringBackend webhook for payment status
payment_methodsstringAllowed methods (e.g., upi, card)

🧾 OrderTags​

Used for analytics or classification.

FieldTypeExample
namestring"Retail"
agestring"New"

πŸ’° Payment Structure​

FieldTypeDescription
idstring/ObjectIDInternal unique payment ID
order_idstringAssociated order
entitystringPayment gateway/provider (e.g., Razorpay)
payment_currencystringCurrency
error_detailsmap[string]string[]Error key-value data
order_amountfloat64Amount from order
is_capturedboolHas the payment been captured
payment_groupstringInternal categorization or batch ID
authorizationAuthorizationAuth and capture details
payment_methodlist[map[string]interface]Dynamic key-value method data
payment_amountfloat64Final amount paid
payment_timetimestampInitiated time
payment_completion_timetimestampTime of completion
payment_statusstringPaid, failed, pending, etc.
payment_messagestringGateway message or user-facing message
bank_referencestringBank/gateway reference ID
auth_idstringAuthorization ID

πŸ” Authorization​

FieldTypeDescription
actionstringe.g., "capture"
statusstringe.g., "success", "failed"
captured_amountfloat64Amount successfully captured
start_timetimestampAuth start
end_timetimestampAuth end
approve_bytimestampDeadline for approval
action_referencestringTransaction ID or internal ref
action_timetimestampActual time of action

πŸ§ͺ RPC Services​

PaymentService​

RPCRequest TypeResponse TypeDescription
CreateOrderCreateOrderRequestCreateOrderResponseInitiates a new order with basic details
VerifyPaymentVerifyPaymentRequestVerifyPaymentResponseChecks payment status of an order

🎯 Requests & Responses​

CreateOrderRequest​

{
"customer_name": "Alice",
"customer_email": "alice@example.com",
"customer_phone": "9999999999",
"order_amount": 299.99
}

CreateOrderResponse​

{
"payment_session_id": "sess_abc123",
"return_url": "https://return.url",
"order_id": "order_xyz789"
}

VerifyPaymentRequest​

{
"order_id": "order_xyz789"
}

VerifyPaymentResponse​

{
"message": "Payment successful",
"code": "200",
"status": "success"
}