用于处理 Balanced 支付的 iOS 库。当前版本:0.4
include 文件夹自动包含在项目头文件搜索路径中。
如果您将文件复制到除 include 之外的任何位置,您可能需要在项目设置中添加 User Header Search Paths 路径。
您可以直接将头文件复制到您的项目中,并将它们添加为直接引用。
#import "Balanced.h" - Tokenizing methods
#import "BPBankAccount.h" - Bank Accounts
#import "BPCard.h" - Cards
使用您的 marketplace URI 实例化一个 balanced 实例。
Balanced *balanced = [[Balanced alloc] initWithMarketplaceURI:@"/v1/marketplaces/TEST-MP6E3EVlPOsagSdcBNUXWBDQ"];
BPCard *card = [[BPCard alloc] initWithNumber:@"4242424242424242" expirationMonth:8 expirationYear:2025 securityCode:@"123"];
使用 NSDictionary 来指定您想指定的附加卡字段。
NSDictionary *optionalFields = @{
BPCardOptionalParamNameKey:@"Johann Bernoulli",
BPCardOptionalParamStreetAddressKey:@"123 Main Street",
BPCardOptionalParamPostalCodeKey:@"11111"
};
BPCard *card = [[BPCard alloc] initWithNumber:@"4242424242424242" expirationMonth:8 expirationYear:2025 securityCode:@"123" optionalFields:optionalFields];
BPCard *card = [[BPCard alloc] initWithNumber:@"4242424242424242" expirationMonth:8 expirationYear:2025 securityCode:@"123"];
Balanced *balanced = [[Balanced alloc] initWithMarketplaceURI:@"/v1/marketplaces/TEST-MP6E3EVlPOsagSdcBNUXWBDQ"];
[balanced tokenizeCard:card onSuccess:^(NSDictionary *responseParams) {
// success
} onError:^(NSError *error) {
// failure
}];
BPBankAccount *ba = [[BPBankAccount alloc] initWithRoutingNumber:@"053101273" accountNumber:@"111111111111" accountType:BPBankAccountTypeChecking name:@"Johann Bernoulli"];
使用 NSDictionary 来指定您想指定的附加卡字段。
NSDictionary *optionalFields = @{BPCardOptionalParamMetaKey:@"Test"};
BPBankAccount *ba = [[BPBankAccount alloc] initWithRoutingNumber:@"053101273" accountNumber:@"111111111111" accountType:BPBankAccountTypeChecking name:@"Johann Bernoulli" optionalFields:optionalFields];
请在所有新代码中包含测试。所有现有测试必须通过,才能合并新代码。