stripe-archive / PaymentKit

Easily accept payments on iOS
MIT License
468 stars 203 forks source link

This project is deprecated and is no longer being actively maintained. Please use the Stripe iOS SDK instead.

PaymentKit

PaymentKit is a utility library for writing payment forms in iOS apps.

Important note

We've moved development of PaymentKit's components into our main iOS SDK. This will make it easier for us to keep them up-to-date, and make installation and integration simpler for most apps. Despite this, please note that you don't have to be a Stripe user to use these components - the UI we've built has no dependencies on the Stripe API.

Migration

If you're using CocoaPods, to install our iOS SDK, just add pod 'Stripe' to your Podfile. For other means of integration, check out our installation guide.

We've renamed PTKView to STPPaymentCardTextField. We've also provided a compatibility shim so if you have an app that uses PaymentKit, you won't have to change any of your code in order to migrate over. However, migration is extremely straightforward:

// Before
- (void)paymentView:(nonnull PTKView *)paymentView withCard:(nonnull PTKCard *)card isValid:(BOOL)valid {
    if (valid) {
        [self doSomethingWithCard:card];
    }
}

// After
- (void)paymentCardTextFieldDidChange:(STPPaymentCardTextField *)textField {
    if (textField.isValid) {
        STPCard *card = [[STPCard alloc] init];
        card.number = textField.cardNumber;
        card.expMonth = textField.expirationMonth;
        card.expYear = textField.expirationYear;
        card.cvc = textField.cvc;
        [self doSomethingWithCard:card];
    }
}

If you have any issues with migration, feel free to contact support@stripe.com.