iOS
Product Features
App payment refers to a payment product in which a merchant integrates the telebirr SDK in the merchant's mobile app and invokes the telebirr to complete payment. This mode is applicable to the scenario where the telebirr payment function is used in the mobile app of the merchant. After the contract is signed, the product can be used only after the technology integration is completed.
Quick access to app payment
Merchants/service providers can quickly access App payment according to this document. Description Only self-developed merchants and service providers are supported. Huawei-developed applications or the Third-Party Application This API is invoked to access the API. Sandbox environment debugging is supported. The server and client need to initiate a payment request together.
Overall Interaction Process
The key steps are briefly described as follows:
- The user purchases a product on the merchant app client and places an order.
- The merchant order information is sent from the merchant app client to the server.
- The merchant server invokes the authorization and order placement API to obtain the receiveCode (including the order information and signature) by invoking the telebirr server API.
- The merchant sends the receiveCode to the merchant app client.
- Initiate a request on the client and send receiveCode to the telebirr app.
- The telebirr client places a payment order in advance based on the request parameters provided by the merchant client. In normal scenarios, the telebirr cashier is invoked to wait for the user to check. If an exception occurs, the system returns the exception information.
- Return to the merchant app.
- After the user completes the payment in the telebirr app, the merchant page is displayed and the final payment result (synchronization notification) is returned.
iOS InApp SDK Access Guide
Currently, the SDK supports only the local framework dependency mode. Step 1 Copy the EthiopiaPaySDK.framework to the project app.
Step 2 Import the telebirr SDK dependency for the project by referring to the following sections. Step 3 Perform the following steps.
- Add: telebirrcustomerApp to Targets -- Info -- Queried URL Scheme
- Set URL Schemes for your app in Targets -- Info -- URL Types.
It is recommended that there be a certain degree of identification with the merchant's app, so that it does not overlap with other merchant apps, otherwise the results returned by telebirr may not be able to correctly jump back to the merchant's app.
Importing SDK Header Files
Implement the openURL: method InAppDelegate.m. In this method, invoke the handleOpenURL: method of the SDK.
Step 4 Obtain the authorization token and pre-order interface. Invoke the payment interface in the new thread to obtain the accessToken and receiveCode. For details, see 6 Backend Interface Description. https://host:38443/apiaccess/payment/gateway/payment/v1/token https://host:38443/apiaccess/payment/gateway/payment/v1/inapp/createOrder Create order response: { "result": "SUCCESS", "code": "0", "msg": "success", "nonce_str": "97fe4ae0c0604854a749fbf2cc1cc712", "sign": "Eo4Bvwx9rpaWAO+iYzaaXHoWBWbYcCGnVZMEcG5TPb8w...", "sign_type": "SHA256WithRSA", "biz_content": { "merch_order_id": "1705460512562", "prepay_id": "080075a4e3213924de2b3b84ad3cac0a6a6001", "receiveCode": "TELEBIRR$BUYGOODS$100100306$12.00$080075a4e3213924de2b3b84ad3cac0a6a6001$120m" } Step 5 Invoke the SDK API to start the payment.
Strictly follow the parameters in the interface document. Parameters that are not in the interface document are invalid and may cause requests to be intercepted or other exceptions. Table 4-1 Key input parameters Parameter name Parameter Description appId AppId of the merchant transferred during payment. shortCode ShortCode of the merchant transferred during payment. receiveCode ReceiveCode returned during pre-order placement, which is mandatory.
ReturnApp is the URL Schemes in Targets > Info > URL Types. Step 6 Listen to the payment callback.
Step 7 Error code description. Error Code Description 0 Payment success.
- 1 Unknown error.
- 2 Parameter error.
- 3 Cancellation of payment
- 10 The Payment is not installed.
- 11 The current version of the Payment does not support this function.
----End