Integrate Mobile SDK
Copy page
Copy page as Markdown for LLMs
Open in ChatGPT
Ask questions about this page
Open in Claude
Ask questions about this page
This guide walks you through implementing Mobile SDK integration with Amazon Payment Services across different mobile platforms.
Prerequisites
Before starting your integration, ensure you have:
-
Test Account Access
Contact merchantsupport-ps@amazon.com to obtain access to our test environment for testing and development. -
Security Credentials
Retrieve your integration credentials from the merchant dashboard:- Log into your Amazon Payment Services test account
- Navigate to Merchant Management → Security Settings
- Save the following values:
- Access Code - Authentication token for API requests
- Merchant Identifier - Your unique merchant ID
- SHA Request/Response - Keys for signature calculation
-
Platform-Specific Setup
Ensure your development environment is configured for your target platform(s).
Integration Steps
Platform Specific Installation
Platform Specific Installation
- iOS
- Android
- React Native
- Flutter
Installation
Add the Amazon Payment Services SDK to your iOS project:
pod 'PayFortSDK'
Implementation
import PayFortSDK
class PaymentViewController: UIViewController {
func processPayment() {
// Initialize PayFort SDK
let payFort = PayFortController.init()
// Prepare payment request
var request: NSMutableDictionary = NSMutableDictionary()
request["command"] = "PURCHASE"
request["access_code"] = "zx0IPmPy5jp1vAz8Kpg7"
request["merchant_identifier"] = "CycHZxVj"
request["merchant_reference"] = "XYZ9239-yu898"
request["amount"] = "10000"
request["currency"] = "AED"
request["language"] = "en"
request["customer_email"] = "customer@example.com"
Installation
Add the Amazon Payment Services SDK to your Android project:
dependencies {
implementation 'com.payfort:fort-android-sdk:1.0.0'
}
Implementation
import com.payfort.fort.android.sdk.base.FortSdk;
import com.payfort.fort.android.sdk.base.callbacks.FortCallBackManager;
public class PaymentActivity extends AppCompatActivity {
private FortSdk fortSdk;
private FortCallBackManager fortCallBackManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payment);
// Initialize SDK
fortSdk = FortSdk.getInstance();
fortCallBackManager = FortCallBackManager.Factory.create();
// Set callback listener
Make sure merchant reference value is unique value per request.
Installation
npm install react-native-payfort-sdk
iOS Setup
cd ios && pod install
Implementation
import PayFort from 'react-native-payfort-sdk';
const PaymentScreen = () => {
const processPayment = async () => {
try {
// Prepare payment request
const request = {
command: 'PURCHASE',
access_code: 'zx0IPmPy5jp1vAz8Kpg7',
merchant_identifier: 'CycHZxVj',
merchant_reference: 'XYZ9239-yu898',
amount: '10000',
currency: 'AED',
language: 'en',
customer_email: 'customer@example.com',
sdk_token: 'Dwp78q3', // From Step 2
signature: 'calculated_signature'
};
Installation
Add to your pubspec.yaml
:
dependencies:
payfort_sdk: ^1.0.0
Implementation
import 'package:payfort_sdk/payfort_sdk.dart';
class PaymentScreen extends StatefulWidget {
@override
_PaymentScreenState createState() => _PaymentScreenState();
}
class _PaymentScreenState extends State<PaymentScreen> {
Future<void> processPayment() async {
try {
// Prepare payment request
Map<String, dynamic> request = {
'command': 'PURCHASE',
'access_code': 'zx0IPmPy5jp1vAz8Kpg7',
'merchant_identifier': 'CycHZxVj',
'merchant_reference': 'XYZ9239-yu898',
'amount': '10000',
Generate SDK Token
Generate SDK Token
Before processing any mobile payment, you must generate an SDK token on your server. This token authenticates mobile SDK requests and has a lifetime of one hour.
API Endpoint
https://sbpaymentservices.payfort.com/FortAPI/paymentApi
Request Sample
{
"command": "SDK_TOKEN",
"access_code": "zx0IPmPy5jp1vAz8Kpg7",
"merchant_identifier": "CycHZxVj",
"language": "en",
"device_id": "ffffffff-a9fa-0b44-7b27-29e70033c587",
"signature": "7cad05f0212ed933c9a5d5dffa31661acf2c827a"
}
Response Sample
{
"command": "SDK_TOKEN",
"access_code": "zx0IPmPy5jp1vAz8Kpg7",
"merchant_identifier": "CycHZxVj",
"language": "en",
"response_message": "Success",
"response_code": "20000",
"status": "20",
"sdk_token": "Dwp78q3",
"signature": "c63c2d931e0c2fd7f8c2c5f5b5c5e5f5d5c5e5f5"
}
Handle Payment Response
Handle Payment Response
After payment processing, the SDK returns the transaction results to your application.
Sample Response
{
"command": "PURCHASE",
"access_code": "zx0IPmPy5jp1vAz8Kpg7",
"merchant_identifier": "CycHZxVj",
"merchant_reference": "XYZ9239-yu898",
"amount": "10000",
"currency": "AED",
"language": "en",
"customer_email": "customer@example.com",
"response_message": "Success",
"response_code": "14000",
"status": "14",
"fort_id": "149295435400084008",
"payment_option": "VISA",
"authorization_code": "123456",
"card_number": "400555******0001",
"expiry_date": "2105",
"signature": "response_signature"
Check transaction status
To check the transaction status, check the Check a Transaction Status section.
Handling the response
If you have a webhook, check the webhook section to understand how we send transaction responses to your system.
For detailed parameter specifications, refer to our Mobile Integration API Reference.
Go-live
Test your integration using one of our testing cards.
Make sure to visit our go-live checklist to go live with your integration.
Support
Need help with your integration? Contact our technical support team at merchantsupport-ps@amazon.com.