GithubHelp home page GithubHelp logo

paymentkit's Introduction

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:

  • Remove any references to 'PaymentKit' in your Podfile, if you're using CocoaPods.
  • Rename any instances of PTKView in your application to STPPaymentCardTextField.
  • Remove any lines that read #import 'PTKView.h', and replace them with #import <Stripe/Stripe.h>.
  • Any classes that implement the PTKViewDelegate protocol should now adopt the STPPaymentCardTextFieldDelegate protocol instead.
  • Adjust your PTKViewDelegate methods as follows:
// 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 [email protected].

paymentkit's People

Contributors

alex-stripe avatar andrewpthorp avatar aquageek avatar azy-dev avatar bg-stripe avatar blommegard avatar brian-stripe avatar chourobin avatar chrishol avatar dennda avatar ekampf avatar jack-stripe avatar jlmendezbonini avatar jmanian avatar jurysch avatar klaaspieter avatar maccman avatar marcelofabri avatar micahhainline avatar michaelvillar avatar mthole avatar phillco avatar qaisjp avatar raylillywhite avatar slaunchaman avatar vprtwn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paymentkit's Issues

Better card number state handling

The various card entry fields currently accomplish a lot of work by inserting/removing spaces; this causes a lot of issues and is accomplishable via way better means.

Access to the stateMeta call

Is it possible that this could get an update to the stateMeta call to publicize it to the delegator? It's difficult otherwise to add an inputAccessoryView if a user is utilizing the PKView inside of a larger form.

WARN | PaymentKit/PaymentKit/PTKTextField.h:25:54: warning: auto property synthesis will not synthesize property 'delegate'; it will be implemented by its superclass, use @dynamic to acknowledge intention [-Wobjc-property-synthesis]

Hi,

I am trying to update my Pod & I cannot get my podspec to validate.

Podfile
platform :ios, '6.1'
pod 'Stripe'
pod 'Stripe/ApplePay'
pod 'ApplePayStubs', :git => 'https://github.com/stripe/ApplePayStubs.git'
pod 'PaymentKit', :git => 'https://github.com/stripe/PaymentKit.git'

podspec:
Pod::Spec.new do |s|

s.name              = 'paywith-iphone-sdk'
s.version           = '1.0.12'
s.summary           = 'PayWith SDK'

s.platform = :ios, '6.1'
s.homepage = 'http://paywith.com'
s.license = {
:type => 'BSD',
:file => 'LICENSE'
}
s.author = {
'YOURNAME' => '[email protected]'
}
s.source = {
:git => 'https://github.com/Wantsa/paywithsdk-ios-pod-source.git',
:tag => s.version.to_s
}
s.resources = 'PayWithSDK.framework/PWResources/'
s.public_header_files = 'PayWithSDK.framework/Headers/
.h'
s.source_files = 'PayWithSDK.framework/Headers/*.h'
s.vendored_frameworks = 'PayWithSDK.framework'
s.frameworks = 'AVFoundation'
s.dependency 'AFNetworking'
s.dependency 'Stripe'
s.dependency 'Stripe/ApplePay'
s.dependency 'ApplePayStubs'
s.dependency 'PaymentKit'
s.dependency 'CardIO'
s.requires_arc = true
end

Pod::Spec.new do |s|

s.name              = 'paywith-iphone-sdk'
s.version           = '1.0.12'
s.summary           = 'PayWith SDK'

s.platform = :ios, '6.1'
s.homepage = 'http://paywith.com'
s.license = {
:type => 'BSD',
:file => 'LICENSE'
}
s.author = {
'YOURNAME' => '[email protected]'
}
s.source = {
:git => 'https://github.com/Wantsa/paywithsdk-ios-pod-source.git',
:tag => s.version.to_s
}
s.resources = 'PayWithSDK.framework/PWResources/'
s.public_header_files = 'PayWithSDK.framework/Headers/
.h'
s.source_files = 'PayWithSDK.framework/Headers/*.h'
s.vendored_frameworks = 'PayWithSDK.framework'
s.frameworks = 'AVFoundation'
s.dependency 'AFNetworking'
s.dependency 'Stripe'
s.dependency 'Stripe/ApplePay'
s.dependency 'ApplePayStubs'
s.dependency 'PaymentKit'
s.dependency 'CardIO'
s.requires_arc = true
end

Warning:
- WARN | PaymentKit/PaymentKit/PTKTextField.h:25:54: warning: auto property synthesis will not synthesize property 'delegate'; it will be implemented by its superclass, use @dynamic to acknowledge intention [-Wobjc-property-synthesis]

Allows months to be entered as 00

The as you type validation in PTKExpiry allows months to be entered as 00.

The following change to isPartiallyValid in PTKExpiry.m corrects the problem.

- (BOOL)isPartiallyValid
{
    if ([self isValidLength]) {
        return [self isValidDate];
    } else {
         return ![_month isEqualToString:@"00"] && [self month] <= 12 && _year.length <= 4;
    }
}

cocoapod Stripe 6.2.0 : duplicate symbols while linking

Hello,
I installed the cocoapod Stripe 6.2.0 to use the PaymentKit framework.
When I compile the project, without any code using PaymentKit, I get errors in the linking phase :

duplicate symbol OBJC_CLASS$_PTKView in:
[...PATH...]/Build/Intermediates/season.build/Debug-iphoneos/season DEV.build/Objects-normal/arm64/PTKView.o
[...PATH...]/Build/Products/Debug-iphoneos/libStripe.a(STPPaymentCardTextField.o)
duplicate symbol OBJC_METACLASS$_PTKView in:
[...PATH...]/Build/Intermediates/season.build/Debug-iphoneos/season DEV.build/Objects-normal/arm64/PTKView.o
[...PATH...]/Build/Products/Debug-iphoneos/libStripe.a(STPPaymentCardTextField.o)
duplicate symbol OBJC_CLASS$_PTKCard in:
[...PATH...]/Build/Intermediates/season.build/Debug-iphoneos/season DEV.build/Objects-normal/arm64/PTKCard.o
[...PATH...]/Build/Products/Debug-iphoneos/libStripe.a(STPPaymentCardTextField.o)
duplicate symbol OBJC_METACLASS$_PTKCard in:
[...PATH...]/Build/Intermediates/season.build/Debug-iphoneos/season DEV.build/Objects-normal/arm64/PTKCard.o
[...PATH...]/Build/Products/Debug-iphoneos/libStripe.a(STPPaymentCardTextField.o)
ld: 4 duplicate symbols for architecture arm64

Feature request: Save credit card option

Hey
I just have a little feature request. I could be nice if there was an option in the PKView, like a check mark, if you would save the credit card (create token).

Invalid Card number doesn't have a red text anymore

Hey guys,

After jmanian commit from 03 and 04 Aug, "improve isPartiallyValid " and "if it's valid then it's partially valid" invalid Card number doesn't have a red text anymore. Is there a reason for removing the red text behavior?

Missing API Delegates?

Included are a number of UITextFieldDelegate delegates: PTKCardCVCDelegate, PTKCardExpiryDelegate and PTKCardNumberDelegate. You can set these as the delegates of UITextField inputs, which ensures that input is limited and formatted.

I tried to use these delegates, but looks like they just doesn't exist:

paymentkit

Fix PTKTextField.h warnings in Xcode 6.3.1

The following warning is present in PTKTextField.h

/.../Pods/PaymentKit/PaymentKit/PTKTextField.h:25:54: Auto property synthesis will not synthesize property 'delegate'; it will be implemented by its superclass, use @dynamic to acknowledge intention

Please fix it.

addressZip not Working

addressZip of cardView didn't added in view. So we always getting null whenever we try to get card.addressZip.

[meta] Refactor to fix UI issues

There are a large number of outstanding issues with PaymentKit that we're working to address. Given the nature of most of the bugs, we're doing a pretty deep refactor, so we'll probably fix a lot of problems in one fell swoop. If you'd like to be notified when we have something ready, please watch this meta-issue!

iOS8 with Swift

Hi there,
I have added the new version of PaymentKit in my project which is iOS8 and swift. I have added the bridging-header. I am getting errors within the PTKView.m - Unkown type name 'NSString'

Looks Broken-ish in iOS 9

I just noticed this in an app that I built using the iOS 8 SDK on a phone that has been updated to iOS 9 (I don't really expect it to behave differently if built using the iOS 9 SDK but just an FYI for the state I'm in):

Since the field uses the standard system font, the widths are off using the new San Francisco and there are some ellipsis truncations happening. In addition, it looks like the color for placeholder text is darker than before? This makes the CC field look like it has already been filled in, this one might just be a 9b2 bug.

@jflinter I'm guessing your big rework of this isn't going to land before iOS 9?

I don't mean to suggest that this needs fixing immediately, particularly this early in the beta process. Just opening to track details.

Undeclared Selector issue?

Imported as instructed but getting a warning on PKTextfield.m file :

Semantic Issue
/PaymentKit/PKTextField.m:51:49: Undeclared selector 'pkTextFieldDidBackSpaceWhileTextIsEmpty:'

For this line :

if([self.delegate respondsToSelector:@selector(pkTextFieldDidBackSpaceWhileTextIsEmpty:)])

All files are imported as are required frameworks. Any ideas?

Textfield becomes uneditable

Steps to reproduce:

  • Enter 4242424242424242 as the card number
  • Don't enter anything else
  • Press backspace once
  • Close the keyboard

Now the textfield is uneditable.

I looked into it a little, and while the textfield is uneditable, the method -firstInvalidField is returning 'self.cardExpiryField.' Since this view isn't visible, when you call 'becomeFirstResponder' on it, nothing happens.

No way to validate custom textFields?

I have created 3 UITextFields (Swift 2.1) ie.,

  • UITextField for card number
  • UITextField for cvc &
  • UITextField for Expiration mm/yy

Now, how do I use stripe's card validator on these? Is it possible to validate my card number, cvc fields using STPCardValidator?

Migration from stripe 4.0 to latest stripe 8.x

I have not updated stripe from a long time and i now it seems that paymentkit is integrated into stripe. So i have used multiple things from paymentkit and i am not able to find proper thing how to migrate the code. I have some queries below.

  1. I am using PTKCardNumber like
    let cardNumber:PTKCardNumber = PTKCardNumber(string:strCardNumber)
  2. PTKCardTypeAmex like to determine which card is it.
  3. PTKTextField for the card like
    PTKTextField.textByRemovingUselessSpacesFromString(str as String)

What is used in place of above this all in new stripe?

Make it with separated fields!

I like the idea of a standarized credit card view, but don't like put all in a single text field. Is not obvios at first the necesary fields.

I think could be better to be able to have each component separated, so I can build the forms as I want (and provide better UI)

Voice Over Accessibility Support

It will be nice to have support for Voice over so blind users can use this control. I will try to contribute and work on it on my free time but if someone beats me to it they can reference this issue.

PTKCardExpiry.m Deprecations

NSGregorianCalendar, NSYearCalendarUnit and NSMonthCalendarUnit were all deprecated in iOS 8.0. They're now NSCalendarIdentifierGregorian, NSCalendarUnitYear and NSCalendarUnitMonth.

Localization Resources not included in pod

I noticed that the Localization is not being pulled down when installing from the podspec.

This results in the card view placeholder text to be literal. Example:

self.cardNumberField.placeholder = NSLocalizedStringFromTable(@"placeholder.card_number", @"STPaymentLocalizable", nil);

will display the placeholder.card_number in the placeholder.

I'm not comfortable enough with podspec files to correct this. I'm inclined to just include the entire resources folder because it has everything we need.

Also, this localization issue is a new change from this commit.

Adding postal code in the PTKView

Hello all,i am facing a huge trouble in adding postal code to the PTKView.Please advice me how to add that or share a example code with me.
Thanks all in advance.

Prefix Resources

The resources should be prefixed with PTK just like the class names and such. Otherwise they may conflict with other resource names. This is especially likely with "placeholder.png".

For example, use PTKAmex.png rather than amex.png.

PTKView is not full width on iPhone 6 and iPhone 6 Plus when running in native resolution

Hi, the PTKViews is positioning its subviews with fixed number sizes and setting its own frame which is used derive the other sibling / subview sizes

As a result it doesn't size its width attractive that don't work well on the iPhone 6 and iPhone 6 Plus when run at full res. @3x for 6+

Steps to reproduce

  • Add PaymentKit to project
  • Ensure that project is running at @3x mode via Lauch storyboard or Default png files in the Info plist
  • Instantiate PTKView and add to view controller view and update its with when viewDidLayoutSubviews

Can it be fixed / refatored to support these larger device widths too or better yet refactored to use Auto Layout?

cc @danieladias

Clear fields

Is there a method to clear fields without having the keyboard open? If I set the cardExpiryField and cardNumberField to @"", the keyboard pops up. I'd like to be able to clear the fields once a card has been submitted (so they can then submit another card).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.