Conekta iOS SDK is a base of App to tokenize Credit/Debit Cards using Conekta REST API and make Payments with tokens, create Customers and save the tokens to Customers for future charges.
- Intro
- Requeriments
- Installation
- Configuration and Setup
- Contributing & Attribution
- License
- Clone the repo to your Mac
git clone [email protected]:javiermurillo/PagosObjectiveC.git
- Xcode 5 or superior.
- PaymentServer to resolve requests and process to Conekta REST API. (ex.
git clone [email protected]:javiermurillo/PagosObjectiveC.git
)
-
Go to
PagosObjectiveC/DFConekta.m
at the line 10, put your Conekta Public Key (admin.conekta.io):NSString *PUBLIC_API_KEY = @"key_XXXXxxxxXXXXxxxx";
-
Run and Compile the Project, you can use "Payment to Conekta API", this option tokenize the credit/debit card and make one payment directly to Conekta REST API (https://api.conekta.io/charges)
If you want to use Charge on-demand, create Customers, you need to complete next steps and use/implement PaymentServer and complete next:
-
Go to
PagosObjectiveC/DFPaymentServer.m
at the line 12 put the URL to make requests to your PaymentServer:NSString *PAYMENT_SERVER_URL = @"http://url-para-payment-server.dominio";
, if you want to make a few tests, you can use your local PaymentServer, ex:http://127.0.0.1:3000
-
You can use this example in Node PaymentServer to solve the request at
http://127.0.0.1:3000
.
if you are using your own endpoint or another PaymentServer, is important define the routes at PagosObjectiveC/DFPaymentServer.m
- (id)initWithBaseUrl:(NSString*)newBaseUrl{
self = [super init];
if (self) {
baseUrl = newBaseUrl;
createClientUrl = @"/client/create";
addCardToClientUrl = @"/client/addCard";
chargeUrl = @"/charge";
}
return self;
}
At this route is creating the request to your PaymentServer to create a Customer at Conekta, you can change the route, at this time, is creating an empty Customer, but you can add the method to create customer with his right credentials.
This route is adding a card to a Customer, the Customer previusly created from App (Conekta iOS SDK), the card is assigned to Customer ID as a token.
Whit this route, we are sending a Charge on-demand to our PaymentServer, from this server is requested to Conekta REST API to make the charge.
Customers allow you to store cards for clients and set up subscriptions, you can get more information at Customer at Conekta REST API
Thanks to Santiago Zavala for helping us to create Conekta iOS SDK and Javier Murillo to write the README.
Developed by Conekta. Available with MIT License.