Create Transaction
Create a Transaction
Creates a new payment session and returns a payment URL that can be used to collect payment from a customer. Use this endpoint whenever you want to initiate a payment through StarPay.Endpoint
Authentication
Include your API secret in the request header. Headerx-api-secret(string) — Required for merchant endpoints. Your StarPay API secret key. Generate this key from the Merchant Portal under API Keys.
Request Body
amount
The amount to be charged to the customer. Type:number — Required
Example:
description
A short description of the payment. This may be displayed to the customer during checkout. Type:string — Required
Example:
currency
The currency used for the transaction. Currently supported:ETB
Type: string — Required
Example:
customerName
The full name of the customer making the payment. Type:string — Required
Example:
customerPhoneNumber
The customer’s phone number. This number may be used for payment verification and payment initiation. Type:string — Required
Example:
items
List of products or services included in the transaction. Type:array — Required
Example:
callbackURL
A server-to-server notification URL that StarPay will call when the payment status changes. Use this to automatically update your system after a successful or failed payment. Type:string — Optional
Example:
Successful Callback Example
Failed Callback Example
redirectUrl
The URL where customers will be redirected after completing payment. Typically a success or order confirmation page. Type:string — Optional
Example:
customerEmail
Customer email address. Type:string — Optional
Example:
expiredAt
The date and time when the payment session expires (ISO 8601 format). After expiration, the customer can no longer complete the payment. Type:string — Optional
Example:
metadata
Additional custom data associated with the transaction. Returned in callbacks and transaction status responses. Type:object — Optional
Example:
Example Request
Response
Success Response
Next Steps
After creating a transaction:- Redirect the customer to the
paymentUrl. - Wait for a callback notification from StarPay.
- Verify the callback signature using your Callback Key (see Callback Signature Verification).
- Update the payment status in your system.
- Optionally query the Transaction Status API for additional verification.
This endpoint documentation follows the structure developers expect: overview, authentication, request parameters, examples, and webhook guidance.
Headers
The App Secret provided by CBE.
"X/2uxXAjJqaai5gRzXHzcFPcx9E6B3pibBbVSoce1U23q5hR2Sr5pxlh6WLQZBep"
Body
The request body(payload) includes the following fields:
api_secretcallbackURLIf you want to receive the customer back in your application after the transaction, you can provide a callback URL. Starpay will automatically redirect the user to your URL when the payment is completed successfully or Failed.
If you provide a callbackURL, StarPay will send the following response to that URL after a successful payment.
The error response for failed payments.
Create session.
1000
"VANS+"
"ETB"
"test"
"+251987654567"
"https://example.com/start_pay_callback"
"test12@gmail.com"
"2025-07-01T23:59:59Z"
-The URL where the payment gateway will automatically redirect the customer after a successful payment. This is used to bring the customer back to your website or app to show a confirmation page, receipt, or next steps.
"https://google.com"
Additional custom information that you can send with the order. This field allows you to include extra data (e.g., order reference, custom fields) that will be returned in the payment response and webhook notifications.