Aman iOS
SDK
Your clients have ready access to all of Aman's payment options.
Prerequisites
Aman SDK will allow your iOS
application to:
- initiates full-screen activities to get the shipping address, method of shipping, and payment information.
- Card, reference code, and installment payment options are easily obtained from Aman.
Make sure you are satisfied with the following compatibility list in order to prevent any conflicts and ensure a smooth integration.
How iOS
SDK Plugin Looks Like



and test Aman demonstrative application.
How it works
We will guide you through the iOS
SDK integration process on this
page:
- Set up and initialize the SDK for
iOS
. - Provide payment options and obtain the payment information from your client.
- Aman will receive a payment request from the Aman
iOS
SDK plugin. - Give our
iOS
SDK plugin the payment processing information back. - Share the payment outcome with your client through your
iOS
application.
SDK Integration
To ensure that the SDK is integrated and prepared for use in your application logic, please adhere to the steps listed below.
SDK API hooks
It's time to learn how to use our SDK API hooks after integrating Aman SDK in order to:
Create Payment Order
dictionary
data should be implemented by your app cart item; the values
that need to be passed through your dictionary
object are shown in the
table below.
Parameter | type | Required | Description | |
---|---|---|---|---|
publickey | String |
required | Your Aman merchant account public key. | |
merchantId | String |
required | Your Aman account merchant ID. | |
merchantName | String |
required | Merchant Name to be displayed in cashier checkout form. | |
reference | String |
required | Payment reference number in your system. | |
countryCode | String |
optional | Country code (EG). | |
currency | String |
required | Currency type (EGP). | |
payAmount | Long |
required | payment total amount. | |
productName | String |
required | Name of Product/Service to be purchased. | |
productDescription | String |
required | Description of Product/Service to be purchased. | |
callbackUrl | String |
required | The callback URL over which you will be listening to the payment status updates. If not configured, you have to configure a webhook url on the merchant dashboard. | |
expireAt | Integer |
required | Payment expiration time in minutes. | |
paymentType | String |
optional | The preferred payment method to be presented to your customer (BankCard, ReferenceCode, Shahry). If not set, all supported payment methods will be available to your customer to choose from. | |
userInfo JSON Object |
||||
userId | String |
optional | the customer user id | |
userName | String |
optional | the customer user name | |
userMobile | String |
optional | the customer user mobile | |
userEmail | String |
optional | the customer user email |
Create dictionary
data as below.
NSDictionary *dic=@{
@"merchantName": merchantName,
@"country": country,
@"reference": reference,
@"amount": @{
@"total": payAmount,
@"currency": currency
},
@"product": @{
@"name": productName,
@"description": productDescription
},
@"returnUrl": returnUrl,
@"callbackUrl": callbackUrl,
@"cancelUrl": cancelUrl,
@"userClientIP":userClientIP,
@"expireAt":@([expireAt integerValue])
};
Now, you need to initialize the management class. Code example as follows:
[[[AmanOrderRequestManager instance]registerApp:publickey MerchantId:merchantId isDebug:_isDebug]
Publickey
is the applied public key, merchantId
is the assigned merchant ID isDebug
: set to yes
to switch to the sandbox
environment. Set to No
to switch to the production environment
To begin creating an order, you must call the AmanOrderRequestManager
management class after initializing the management class. You can use the sample
code that follows.
[[AmanOrderRequestManager instance] sendOrder:dic successHandler:^(id _Nonnull result) {
//Success callback
} errorHandler:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
//error message callback
} failHandler:^{
//failed callback
}];
failHandler
: Handle the logic for the callback after the service fails
to be called.
successHandler
: For the callback after the service is called
successfully,
the callback parameter result is the result returned by the calling service.
The type is a dictionary
and contains order information. Sample
response
is given below:
{
code = 00000;
data = {
amount = {
currency = EGP;
total = 1000;
};
cashierUrl = "https://sandboxcashier.Amancheckout.com/checkout-list?orderNo=211026140930379662&merchantId=256621050820270&country=EG&rc=false";
orderNo = 211026140930379662;
reference = 12347544444555666llljhh;
status = INITIAL;
vat = {
currency = EGP;
total = 0;
};
};
message = SUCCESSFUL;
}
You should build some logic deal with any errors that a request or the system may return, depending on the status code of the response. The list of potential error codes that you might see is provided below.
Error Code | Error Message |
---|---|
02000 | Authentication failed. |
02001 | The request parameters are invalid. |
02002 | The merchant has not configured this feature. |
02003 | Payment method not support. |
02004 | Order already exists. |
02007 | Merchant unavailable. |
50003 | The service is unavailable, please try again. |
Handling Payment Result
Aman server will respond back to the SDK to let you know the payment processing result, Once the payment has been completed by your client. Following your client's payment completion, you will receive the payment processing result as a JSON object. :
Sample response Json
object.
{
callbackName = clickReferenceCodeReturnBtn;
eventName = clickReferenceCodeReturnBtn;
merchantId = 256621050820270;
orderNo = 211026140930379662;
orderStatus = PENDING; // INITIAL - SUCCESS - FAIL - CLOSE
payNo = 211026140930379662;
referenceCode = 607943772;
}
Order Query Status
The order status might not be available on time due to network and other problems. To
make sure your data is accurate, it is highly recommended that you call order status
inquiry. Consequently, you will have to make a dictionary
with the
following request parameters in it:
Parameter | type | Required | Description |
---|---|---|---|
privateKey | String |
required | Your Aman merchant account public key. |
merchantId | String |
required | Your Aman account merchant ID. |
reference | String |
required (if no orderNo provide) | Payment reference number in your system. |
orderNo | String |
required (if no reference provide) | Order id. |
countryCode | String |
required | Country code (EG). |
reference
and
orderNo
keys.
NSDictionary *dic=@{
@"country": countryCode,
@"reference": reference,
@"orderNo":orderNo
};
Following the creation of the query dictionary
, the management class
needs to be initialized as follows:
[[[AmanOrderRequestManager instance]registerApp: privateKey MerchantId:merchantId isDebug:_isDebug]
Now, you need to :
[AmanOrderRequestManager instance] queryOrder:dic successHandler:^(NSString * _Nonnull code, NSString *
_Nonnull errorMsg, id _Nonnull result) {
} failHandler:^{
}];
failHandler
: Handle the logic for the callback after the service fails
to be called.
successHandler
: For the callback after the service is called
successfully,
the callback parameter result is the result returned by the calling service.
The type is a dictionary
and contains order status information. Sample
response
is given below:
{
"code": "00000",
"message": "SUCCESSFUL",
"data":{
"reference":"1001000",
"orderNo":"10212100000034000",
"status":"SUCCESS",
"vat":{
"total":10000,
"currency":"EGP",
"rate":100,
"currencySymbo":"ج.م"
},
"failureReason":null,
"silence":"Y"
}
You should include some logic to handle any errors that a request or the system may return, depending on the status code of the response. Below is a list of potential error codes that you might encounter.
Error Code | Error Message |
---|---|
02000 | Authentication failed. |
02001 | The request parameters are invalid. |
02002 | The merchant has not configured this feature. |
02006 | Order not found. |
02007 | Merchant unavailable. |
50003 | The service is unavailable, please try again. |