initiate_payment
STEP 2 of the in-chat payment flow. Starts a payment session for an order and returns a PaymentSession with an instruction the agent renders in chat. REQUIRES a buyer_delegation_token — obtain it exactly like execute_checkout: call request_delegation, have the user approve in chat, then check_delegation to get the token (spending money always needs human approval). For channel "mobile_money" you MUST collect the buyer's phone (Ghana: 055… or +233…) and provider — use codes mtn, vod (Vodafone/Telecel), or tgo (AirtelTigo); aliases telecel→vod, tigo→tgo are accepted. ALWAYS quote the Show this instruction to the buyer line from the response verbatim (Paystack display_text). For channel "card", no phone/provider is needed; the response instruction contains an authorization_url you send the user to. After calling: if instruction.action == "submit_otp", ask the user for the OTP and call submit_payment_otp. If instruction.action == "approve_on_phone", tell the user to approve the prompt on their phone, then poll get_payment_status. If instruction.action == "redirect" (card), send the user the authorization_url, then poll get_payment_status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| phone | No | Buyer mobile-money phone number (required for channel "mobile_money") | |
| channel | Yes | Payment channel chosen by the buyer (from get_payment_methods) | |
| gateway | No | Payment gateway to use when the store has more than one enabled (see get_payment_methods.gateways[].id). Optional — defaults to the store's first enabled gateway. | |
| site_id | No | Registered site ID (optional if DEFAULT_SITE_ID is set) | |
| order_id | Yes | Order ID to pay for | |
| provider | No | Mobile-money provider (required for channel "mobile_money"). Codes: mtn, vod (Vodafone/Telecel), tgo (AirtelTigo). | |
| buyer_delegation_token | No | Delegation token from the buyer (from request_delegation/check_delegation). Required — payments always need human approval. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | No | ||
| reference | No | ||
| instruction | No | ||
| payment_status | No |