Virtual Card Checkout
Virtual Card Checkout
Overview
Items you will need:
- The Zip iOS SDK
- The Start Checkout call in your iOS app
- A payment processor for credit card transactions
Implementation
The Zip iOS SDK
Our SDK is currently public, simply add the following to your Podfile and run pod install
pod 'QuadPaySDK'
https://cocoapods.org/pods/QuadPaySDK
How to start a Zip checkout in your iOS App
Initialize the Zip SDK
our merchant id will be provided by your Zip account manager.
Please make sure you are using the production merchantId with environment "production" and the sandbox merchantId with environment "sandbox".
Typically this is done in didFinishLaunchingWithOptions:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[QuadPay sharedInstance] initialize:@"<merchant_id>"
environment:@"production"
locale:@"US"
];
return YES;
}
Start the Zip Checkout
Once presented the customer will be shown the Zip checkout flow.
UINavigationController *navController = [
QuadPay startVirtualCheckout
delegate:self
amount:@"123.45"
merchantReference"@"unique-order-id"
customerFirstName@"Zip"
customerLastName:@"Customer"
customerEmail:@"[email protected]"
customerPhoneNumber:@"+15555555555"
customerAddressLine1:@"123 Main St."
customerAddressLine2:@"10th Floor"
customerCity:@"New York"
customerState:@"NY"
customerPostalCode:@"10003"
customerCountry:@"US"
merchantFeeForPaymentPlan: "0"
];
[self presentViewController:navController animated:YES completion:nil];
Implement the QPVirtualCheckoutDelegate functions
These functions give your application information regarding the result of the Zip checkout flow.
Checkout Success
This function returns a token you may exchange to confirm an order has been created.
- (void)checkoutSuccessful:(QuadPayCard *)card cardholder:(QuadPayCardHolder *)cardholder orderId:(nonnull NSString *)orderId
{
// The user has completed checkout
// A virtual card has been returned
// Pass the details in card and cardholder into your standard payment processor
NSLog(@"%@", [NSString stringWithFormat:@"Card: %@ Issued for %@", [card toString], [cardholder toString], [orderId]]);
}
For card and cardholder types please see https://developers.zip.co/v9-US/docs/object-model#card.
Checkout Cancelled
This function is called when the user cancels the Zip process or is declined.
- (void)checkoutCancelled:(NSString *)reason
{
// The Zip checkout session has been cancelled
NSLog(@"%@", [NSString stringWithFormat:@"User cancelled QuadPay checkout with reason %@", reason]);
}
Finishing the Zip order
Once you have received a virtual card number in a success delegate you may authorize and capture it up to the value provided at the beginning of checkout. The card that is issued is a standard Visa card and all authorize/capture/refund functionality will work as expected.
More information and frequently asked questions are available at https://developers.zip.co/v9-US/docs/how-it-works.
Updated about 2 years ago