Custom app integration
Make your doctype payable
# your_app/your_app/doctype/order/order.py
class Order(Document):
def on_payment_authorized(self, status):
"""Called by Payment Core when the payment settles."""
if status == "Paid":
self.status = "Paid"
self.save()
# fulfil the order, send confirmation, etc.
Optional hooks
Declare in your app hooks.py:
# Run your own payment flow (Payment Core becomes gateway-only on your site)
uses_own_payment_flow = True
# Declare your customer doctype for buyer resolution
payment_customer_doctype = "Contact"
# Register your settings doctype for the Gateway Settings hub
payment_gateway_settings_doctypes = ["Your Gateway Settings"]
# Custom analytics adapter (gateway-only sites)
payment_analytics_adapter = "your_app.analytics.build_analytics"
Key API endpoints
| Endpoint | Description |
|---|---|
payment_core.utils.create_payment_transaction |
Create or reuse a payment attempt |
payment_core.utils.update_payment_transaction |
Update status, provider IDs, metadata |
payment_core.utils.initiate_transaction |
Submit a Draft transaction (elevated, guest-safe) |
payment_core.utils.get_checkout_url |
Get a gateway-hosted checkout URL (guest-accessible, rate-limited) |
payment_core.utils.reconcile_payment_status |
Guest-safe status poll for the success page |
payment_core.utils.record_payment_receipt |
Book a Capture/Refund receipt |
payment_core.utils.refund_payment_transaction |
Execute a provider refund (idempotent) |
payment_core.analytics.get_analytics |
Full analytics payload (period, currency, doctype scoped) |
Last updated 2 weeks ago
Was this helpful?