Setup SDK
For my2c2p payment, you need private+public key pem file. For make sure , please open your .pem file with text editor and search public and private . If it include both , we can configure the key for iOS.
If you only have private.pem and public.crt , you can merge this two file for iOS pem key.
If you don't have any keys, you can generate with key gen.
Configure Public Key
- Browser to my2C2P Portal.
- Navigate to Account -> Options
- In Payment Result Section , update your public key
Configure Private Key
- Open my2c2p Encoded.app.
- Click the Browse...
- chose your iosprivate.pem file (include private+public)
- Enter your password
- Click Copy
You will get the encrypted code in your clipboard.
Creating Bridge File For Swift
If you are using Swift, we need to setup Bridge.
- Go to
File > New > File...
and chose the Header File. - Give the name Bridge.h
- Save the same path of .xcodeproj
- Select The Project
- Select The Targets
- Go To Build Settings
- Search Objective-C Bridging Header
- Add Bridge.h
In the Bridge.h, add
#import <PGW/PGW.h>
Import Header For Objective-C
Add following code in your .h
#import <PGW/PGW.h>
Initialize my2c2pSDK
....
@property (nonatomic,strong) My2c2pSDK *paymentSDK;
....
paymentSDK = [[My2c2pSDK alloc] initWithPrivateKey:@"PASTE_YOUR_ENCRYPTED_KEY"];
let paymentSDK = My2c2pSDK(privateKey: "PASTE_YOUR_ENCRYPTED_KEY")!
If you want to customize the 2c2p Payment UI, you need to download the CustomUIPaymentFormViewController.xib
App Scheme Declaration (OPTIONAL)
Note : Scheme required for 123 payment : eNETS (Direct Debit/Web Payment)
If you want to use eNETS, please add the scheme as following.
Go to Target > Select Product > Info > URL Types
Add
my2c2p[your merchant ID]
in URL Schemes. If your merchant ID is JT01 , it will be like following.
If user want to make payment via Bank (Direct Debit), it will open the Safair instead on in app webview. Without Scheme , safari cannot reopen the app after finish payment.
Note : Scheme required for Alipay
If you want to use Alipay, please add the scheme as following.
Go to Target > Select Product > Info > URL Types
Add my2c2pAlipay in URL Schemes. It will be like following.