iOS SDK
Legacy SDK, not recommended for new integrations. Integrate PayMe into your iOS app with the PayMe iOS SDK: import the framework, initialize the SDK, and pay sales, pay subscriptions and capture buyers.
Legacy SDK. This SDK is no longer recommended for new integrations. It isn't actively updated, it requires your app to collect card details, and it puts your
seller_payme_id(MPL), a server-side credential, in the app. For new apps, open the Hosted Payment Page in a secure in-app browser (SFSafariViewControlleron iOS), so card details never pass through your app. You can also offer Apple Pay and Google Pay.How to: Accept payments in a mobile app.
To get the SDK, ask PayMe Partners (partners@payme.io) for access.
Getting started
Get the PayMe package
Build the framework from sources:
- Open the PayMe project.
- Build the project.
- The new framework is generated automatically in the Products directory of
PMLib.xcodeproj:PMLib.framework. - Right-click → Show in Finder to get the path of the framework.
Import the PayMe SDK framework
- Open the project that needs to import the framework.
- Select your project's Targets → General → Embedded Binaries (or Build Phases → Embedded Frameworks).
- Press Add (+) and go to the path of
PMLib.framework. - Build the project.
Initialize the SDK
Create a shared PayMe instance, for example in your app delegate:
#import <PMLib/PayMe.h>
#define SELLERKEY @"/* Your seller_payme_id */"
#define WEBSERVICE [PayMe sharedInstant:SELLERKEY stage:STAGING]
stage sets the environment. The sample uses STAGING; ask PayMe Partners for the value to use in production.
The samples below call WEBSERVICE and leave the success and failure handling to you.
Integrate with the PayMe API
Each API request requires appropriate PayMeRequest and TransactionListener instances.
Pay a sale
First, create the sale on your server with generate-sale and send its payme_sale_id to your app. Then create a PaySaleRequest and send it:
PaySaleRequest *request = [[PaySaleRequest alloc] init];
//payme_sale_id - Required - From your server
request.paymeSaleId = /* payme_sale_id */;
//Installments - Required
request.installments = installments;
//ID - Required only for Israeli cards
request.buyerSocialID = buyerSocialID;
//Email - Required
request.buyerEmail = buyerEmail;
//Name - Required
request.buyerName = buyerName;
//Credit Card Number - Required
request.creditCardNumber = creditCardNumber;
//CreditCard CVV - Required
request.creditCardCVV = creditCardCVV;
//Credit Card Expiration - Required
request.creditCardExp = creditCardExp;
[WEBSERVICE paySale:request success:^(PaySaleResponse *responseObject) {
if(responseObject != nil)
{
//Handle success request
}
} failure:^(PayMeError *error) {
if(error != nil)
{
//Handle failed request
}
}];
Pay a subscription
First, create the subscription on your server with generate-subscription and send its sub_payme_id to your app. Then create a PaySubscriptionRequest and send it:
PaySubscriptionRequest *request = [[PaySubscriptionRequest alloc] init];
//Name - Required
request.buyerName = buyerName;
//ID - Required only for Israeli cards
request.buyerSocialId = buyerSocialId;
//Phone
request.buyerPhone = buyerPhone;
//Email - Required
request.buyerEmail = buyerEmail;
//sub_payme_id - Required - From your server
request.subPaymeId = /* sub_payme_id */;
//Credit Card Number - Required
request.creditCardNumber = creditCardNumber;
//CreditCard CVV - Required
request.creditCardCVV = creditCardCVV;
//Credit Card Expiration - Required
request.creditCardExp = creditCardExp;
[WEBSERVICE paySubscription:request success:^(PaySubscriptionResponse *responseObject) {
if(responseObject != nil)
{
//Handle success request
}
} failure:^(PayMeError *error) {
if(error != nil)
{
//Handle failed request
}
}];
Capture a buyer token
CaptureBuyerRequest *request = [[CaptureBuyerRequest alloc] init];
//Name - Required
request.buyerName = buyerName;
//Phone - Required
request.buyerPhone = buyerPhone;
//Email - Required
request.buyerEmail = buyerEmail;
//ID - Required only for Israeli cards
request.buyerSocialId = buyerSocialId;
//SellerID - Required
request.sellerPaymeId = /* Your seller_payme_id */;
//Permanent
request.buyerIsPermanent = buyerIsPermanent;
//Credit Card Number - Required
request.creditCardNumber = creditCardNumber;
//CreditCard CVV - Required
request.creditCardCvv = creditCardCVV;
//Credit Card Expiration - Required
request.creditCardExp = creditCardExp;
[WEBSERVICE captureBuyer:request success:^(CaptureBuyerResponse *responseObject) {
if(responseObject != nil)
{
//Handle success request
}
} failure:^(PayMeError *error) {
if(error != nil)
{
//Handle failed request
}
}];