question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help integrating Stripe payment processing

See original GitHub issue

I’m working on trying to integrate a payment processor into Kivy. I’ve got Stripe working on Android which wasn’t too bad with Pyjnius but now I’m trying to do the same with kivy-ios. The amount of code it takes is pretty simple.

STPCardParams * cardParams = [[STPCardParams alloc] init];
cardParams.number = @"4242424242424242";
cardParams.expMonth = 10;
cardParams.expYear = 2018;
cardParams.cvc = @"123";

[[STPAPIClient sharedClient] createTokenWithCard:cardParams completion: ^ (STPToken * token, NSError * error){if (token == nil || error != nil){// Presenterrortouser...return;}

[self submitTokenToBackend:tokencompletion: ^ (NSError * error){if (error){// Presenterrortouser...}else {// Continuewith payment...}}];}];

I was going to go about it with pyobjus but then I ran into this issue with the completion:^ blocker https://github.com/kivy/pyobjus/issues/32. So I can’t use that so now I’m working on writing in obj-c and wrapping it with cython like the AVfoundation for the camera (https://github.com/kivy/kivy/tree/master/kivy/core/camera). So far I’ve got a rough wrapper made https://github.com/GoBig87/Stripe_iOS_Wrapper/tree/0.1 and a recipe to build a lib for it with this recipe

from toolchain import CythonRecipe, shprint
from os.path import join
from distutils.dir_util import copy_tree
import fnmatch
import sh
import os

class StripeRecipe(CythonRecipe):
    version = "0.1"
    url = "https://github.com/GoBig87/Stripe_iOS_Wrapper/archive/{version}.zip"
    library = "stripe_ios.a"
    pbx_frameworks = ['Stripe']
    depends = ["python","hostpython"]

    def install(self):
        pass
        arch = list(self.filtered_archs)[0]
        build_dir = join(self.get_build_dir(arch.arch),'build','lib.macosx-10.13-x86_64-2.7')
        dist_dir  = join(self.ctx.dist_dir,'root','python','lib','python2.7','site-packages','stripe_ios')
        copy_tree(build_dir, dist_dir)

    def biglink(self):
        dirs = []
        for root, dirnames, filenames in os.walk(self.build_dir):
            if fnmatch.filter(filenames, "*.so.*"):
                dirs.append(root)
        cmd = sh.Command(join(self.ctx.root_dir, "tools", "biglink"))
        shprint(cmd, join(self.build_dir, "stripe_ios.a"), *dirs)

recipe = StripeRecipe()

which when building with ./toolchain.py gives the following

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
GoBig87commented, Jul 3, 2018

So I got it working. My method was to use cython to wrap C which wrapped objc. The stripe objc framework was then able to be called and return a value to my app with a call back. I’ll leave a more detailed update with a pull request with the stripe recipe. The codes all online right now on my github page just got to submit it properly.

0reactions
Zen-CODEcommented, Jun 29, 2020

Closing as this is not really a Kivy issue? Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Payments | Stripe Documentation
Find a guide to integrate Stripe's payments APIs. ... Build a payment form or use a prebuilt checkout page to accept online payments....
Read more >
Payment method integration options | Stripe Documentation
When you add Link to your Elements integration, your customers can save, change, and manage all their payment details in Link. As Stripe...
Read more >
Stripe Documentation
Explore our guides and examples to integrate Stripe. Payments. Build a web or mobile integration to accept payments online or in person.
Read more >
Set up your integration | Stripe Documentation
Set up a Stripe Terminal SDK or server-driven integration to accept in-person payments.
Read more >
Designing an integration | Stripe Documentation
Use this guide to help you decide on the best way to build your integration, and follow the links to in-depth, step-by-step guides....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found