Set up MoneyCollect Server side Client side

Firstly, you need a MoneyCollect account. Register now.

1. Set up Server-side

If the client side wants to access most of the MoneyConnectServer API, it needs the dashboard to initiate a request through the private key.

Download the mock merchant portal interface code on github.

1.1 Using your own key to replace the public key and private key in the file

//Your account PUBLIC_SECRET("Bearer "+PUBLIC_SECRET)
private static final String PUBLIC_SECRET = "Bearer live_pu_OGJ0EidwEg4GjymEiRD7cUBk7IQIYmhwhJlUM****";
//Your account PRIVATE_SECRET("Bearer "+PRVATE_SECRET)
private static final String PRIVATE_SECRET = "Bearer live_pr_OGJ0EidwEg4GjymEiRD4MRxBCo0OumdH6URv****";


1.2 Modify server port(Default to be 9898)


The merchant replaces the public key and private key in the code with their own, and then switch on the server code's default port 9099 can be modified.(The dashboard interface address is the local ip:9898)

2. Set up Client-side

Import MoneyCollect iOS sdk, and then initialize the sdk.

2.1 Installation

To integrate MoneyCollect into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'MoneyCollect', '~> 0.0.1'

2.2 Initialize sdk

Initialize MoneyCollect iOS sdk in the project AppDelegate.

/** API publishable Key */
@property (nonatomic,copy) NSString *publishableKey;

/** The customer IP address passed by the merchant*/
@property (nonatomic,copy) NSString *customerIPAddress;

/// Set publishable Key and customer IP Address
/// @param publishableKey publishable Key
/// @param customerIPAddress IP Address
- (void)setPublishableKey:(NSString * _Nonnull)publishableKey atCustomerIPAddress:(NSString *)customerIPAddress;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Initiate PublishableKey and IPAddress
    [[MCAPIClient shared] setPublishableKey:@"Bearer test_pu_1sWrsjQP9PJiCwGsYv3risSn8YBCIEMNoVFIo8eR6s" atCustomerIPAddress:@""];
    return YES;

3. Construct the data parameters to initiate transaction, and then start the payment activity

The merchant constructs the transaction request parameters and clicks the Checkout button to start the payment activity.(The details of using constructMCCreatePaymentParams method to construct data please refer to Example)

#pragma mark - Button Click Event
- (void)checkoutBtnClick:(UIButton *)sender
    // Initiate controller
    MCSelectPaymentCardVC *selectPaymentCardVC = [[MCSelectPaymentCardVC alloc] init];
    selectPaymentCardVC.delegate = self;

    // Build request parameters
    selectPaymentCardVC.customerID = [MCConfigurationFile getCustomerID];
    selectPaymentCardVC.billingDetails = [MCConfigurationFile getBillingDetailsModel];
    selectPaymentCardVC.createPaymentParams = [self constructMCCreatePaymentParams];
    // Load view
    [selectPaymentCardVC present:self];

After the customer completes the payment by clicking Pay Now button, the payment activity will be dismissed and return to the Example's MCPaymentSheetCheckoutVC. At the same time,return the payment result responseObject through the proxy.

#pragma mark - MCSelectPaymentCardVCDelegate
- (void)successfulTransactionWithResponseObject:(NSDictionary *)responseObject
    // transaction status
    NSString *status = [[responseObject objectForKey:@"data"] objectForKey:@"status"];
    if ([status isEqualToString:@"succeeded"]) {
    }else if ([status isEqualToString:@"failed"]) {
        NSLog(@"%@",[[responseObject objectForKey:@"data"] objectForKey:@"errorMessage"]);
    }else if ([status isEqualToString:@"pending"]) {
    }else if ([status isEqualToString:@"uncaptured"]) {
    }else if ([status isEqualToString:@"canceled"]) {
    }else {

4. Additional testing resources

There are several test cards you can use to make sure your integration is ready for production. Use them with any CVC, postal code, and future expiration date.


4242 4242 4242 4242


Succeeds and immediately processes the payment.

3566 0020 2036 0505


Succeeds and immediately processes the payment.

6011 1111 1111 1117


Succeeds and immediately processes the payment.

3782 8224 6310 0052

American Express

Succeeds and immediately processes the payment.

5555 5555 5555 4444


Succeeds and immediately processes the payment.



This card requires 3D authentication on all transaction

4000 0000 0000 0077


Always fails with a decline code of declined.

Last updated