|
1 | | -# dojo-ios-sdk |
| 1 | +# Dojo iOS SDK |
2 | 2 |
|
3 | | -## Example |
| 3 | + |
| 4 | +[](https://github.com/dojo-engineering/dojo-ios-sdk/blob/master/LICENSE) |
| 5 | +[](https://github.com/dojo-engineering/dojo-ios-sdk/tree/master) |
4 | 6 |
|
5 | | -To run the example project, clone the repo, and run `pod install` from the Example directory first. |
| 7 | +[📚 Integration guide](https://docs.dojo.tech/payments/mobile-integration/ios/accept-payments/ios-step-by-step-guide) | [🧑💻 Setup Apple Pay](https://docs.dojo.tech/payments/mobile-integration/ios/accept-payments/ios-setup-apple-pay) | [📱 Demo](https://docs.dojo.tech/payments/mobile-integration/ios/ios-demo) | [🛠️ Releases](https://github.com/dojo-engineering/dojo-ios-sdk/releases) |
| 8 | + |
| 9 | +The Dojo iOS SDK lets you build a simple and intuitive payment experience in your iOS mobile app. |
| 10 | +Our default theme comes in both light and dark modes, right out of the box, which your users will love! What's more, you can customize the UI screens and add more elements to collect payment details. |
6 | 11 |
|
7 | 12 | ## Requirements |
8 | 13 |
|
9 | | -Minimum iOS version: 11.0 |
| 14 | +iOS version **11.0** and later. |
10 | 15 |
|
11 | 16 | ## Installation |
12 | 17 |
|
13 | | -dojo-ios-sdk is available through [CocoaPods](https://cocoapods.org). To install |
14 | | -it, simply add the following line to your Podfile: |
15 | | - |
16 | | -```ruby |
17 | | -pod 'dojo-ios-sdk', :git => '[email protected]:Dojo-Engineering/dojo-ios-sdk.git', :tag => '1.0.0' |
18 | | -``` |
19 | | -## How to use |
20 | | -SDK functionality can be accessed via DojoSdk object. |
21 | | - |
22 | | -## Swift |
23 | | - |
24 | | -### Card payment |
25 | | -```swift |
26 | | -import dojo_ios_sdk |
27 | | - |
28 | | -let cardPaymentPayload = DojoCardPaymentPayload(cardDetails: DojoCardDetails(cardNumber: "4456530000001096", cardName: "Card Holder Name", expiryDate: "12 / 24", cv2: "020")) |
29 | | -let token = "Token from Payment Intent (connecteToken)" |
30 | | -DojoSDK.executeCardPayment(token: token, |
31 | | - payload: cardPaymentPayload, |
32 | | - fromViewController: self) { [weak self] result in |
33 | | - print(result) |
34 | | -} |
35 | | -``` |
36 | | -This example includes only required fields, you can find additional fields that can be passed in the API reference. |
37 | | - |
38 | | -### ApplePay Payment |
39 | | -```swift |
40 | | -import dojo_ios_sdk |
41 | | - |
42 | | -let applePayConfig = DojoApplePayConfig(merchantIdentifier:"merchant.uk.co.paymentsense.sdk.demo.app", supportedCards: ["visa","mastercard", "amex", "maestro"]) |
43 | | -let applePayPayload = DojoApplePayPayload(applePayConfig: applePayConfig) |
44 | | -let paymentIntent = DojoPaymentIntent(id: "Payment intent ID", totalAmount: DojoPaymentIntentAmount(value: 120, currencyCode: "GBP")) |
45 | | -DojoSDK.executeApplePayPayment(paymentIntent: paymentIntent, payload: applePayPayload, fromViewController: self) { [weak self] result in |
46 | | - print(result) |
47 | | -} |
48 | | -``` |
49 | | -This example includes only required fields, you can find additional fields that can be passed in the API reference. |
50 | | - |
51 | | -## Objective-C |
52 | | - |
53 | | -### Card payment |
54 | | - |
55 | | -``` |
56 | | -#import <dojo_ios_sdk/dojo_ios_sdk-Swift.h> |
57 | | -
|
58 | | -DojoCardPaymentPayload* cardPaymentPayload = [[DojoCardPaymentPayload alloc] |
59 | | - initWithCardDetails: [[DojoCardDetails alloc] |
60 | | - initWithCardNumber:@"4456530000001096" |
61 | | - cardName:@"Card Holder Name" |
62 | | - expiryDate:@"12 / 24" |
63 | | - cv2:@"020"] |
64 | | - userEmailAddress: NULL |
65 | | - userPhoneNumber: NULL |
66 | | - billingAddress: NULL |
67 | | - shippingDetails: NULL |
68 | | - metaData: NULL |
69 | | - savePaymentMethod: FALSE]; |
70 | | -NSString *token = @"Token from Payment Intent"; |
71 | | -[DojoSDK executeCardPaymentWithToken: token payload: cardPaymentPayload fromViewController: self completion:^(NSInteger result) { |
72 | | - NSLog(@"%ld", (long)result); |
73 | | -}]; |
74 | | -``` |
75 | | - |
76 | | -### ApplePay Payment |
77 | | - |
78 | | -``` |
79 | | -#import <dojo_ios_sdk/dojo_ios_sdk-Swift.h> |
80 | | -
|
81 | | -DojoApplePayConfig *applePayConfig = [[DojoApplePayConfig alloc] initWithMerchantIdentifier: @"merchant.uk.co.paymentsense.sdk.demo.app" |
82 | | - supportedCards: [NSArray arrayWithObjects: @"visa", @"mastercard", nil] |
83 | | - collectBillingAddress: FALSE |
84 | | - collectShippingAddress: FALSE |
85 | | - collectEmail: FALSE]; |
86 | | -DojoApplePayPayload *applePayPayload = [[DojoApplePayPayload alloc] initWithApplePayConfig: applePayConfig userEmailAddress: NULL metaData: NULL]; |
87 | | -DojoPaymentIntent *paymentIntent = [[DojoPaymentIntent alloc] initWithId: @"PaymentIntent ID" clientSessionSecret: @"Token from Payment Intent" totalAmount: [[DojoPaymentIntentAmount alloc] initWithValue: 120 currencyCode:@"GBP"]]; |
88 | | - |
89 | | -[DojoSDK executeApplePayPaymentWithPaymentIntent: paymentIntent payload: applePayPayload fromViewController:self completion: ^(NSInteger result) { |
90 | | - NSLog(@"%ld", (long)result); |
91 | | -}]; |
92 | | -``` |
93 | | - |
94 | | -This example includes only required fields, you can find additional fields that can be passed in the API reference. |
95 | | - |
96 | | - |
97 | | -## Result codes |
98 | | - |
99 | | -``` |
100 | | -successful = 0 |
101 | | -authorizing = 3 |
102 | | -referred = 4 |
103 | | -declined = 5 |
104 | | -duplicateTransaction = 20 |
105 | | -failed = 30 |
106 | | -waitingPreExecute = 99 |
107 | | -invalidRequest = 400 |
108 | | -issueWithAccessToken = 401 |
109 | | -noAccessTokenSupplied = 404 |
110 | | -internalServerError = 500 |
111 | | - |
112 | | -sdkInternalError = 7770 |
113 | | -``` |
114 | | - |
115 | | -## License |
116 | | - |
117 | | -dojo-ios-sdk is available under the MIT license. See the LICENSE file for more info. |
| 18 | +The Dojo iOS SDK is available on [CocoaPods](https://cocoapods.org) and [Swift Package Manager](https://www.swift.org/package-manager/). Check out our [setup guide 🔧](https://docs.dojo.tech/payments/mobile-integration/ios/ios-setup) to get started. |
| 19 | + |
| 20 | +## Accept payments |
| 21 | + |
| 22 | +Once you've installed and setup the Dojo iOS SDK, you can configure your app to start [accepting payments 💳](https://docs.dojo.tech/payments/mobile-integration/ios/ios-accept-payments). |
| 23 | + |
| 24 | +## Save card |
| 25 | + |
| 26 | +You can provide your mobile app users with the ability to [save their card information](https://docs.dojo.tech/payments/mobile-integration/ios/accept-payments/ios-save-card) securely for future use. |
| 27 | +The following is an example of this feature. |
| 28 | + |
| 29 | +<img src="https://docs.dojo.tech/images/save-card-pay.gif" width="200"> |
| 30 | + |
| 31 | +## Contributing |
| 32 | + |
| 33 | +We welcome contributions for features, bug fixes, enhancements, or any documentation feedback. Feel free to [open an issue](https://github.com/dojo-engineering/dojo-ios-sdk/issues) describing your contribution in detail and we will get back to you soon to take it forward. |
| 34 | + |
| 35 | +## Let's connect 🤝! |
| 36 | + |
| 37 | +Show some love to our developers and connect with them on our [Discord server](https://discord.gg/9UzNq4Hz93). |
0 commit comments