Skip to content

Instantly share code, notes, and snippets.

var AWS = require("aws-sdk");
var IM = require('imagemagick');
var FS = require('fs');
var compressedJpegFileQuality = 0.60;
var compressedPngFileQuality = 0.95;
exports.handler = (event, context, callback) => {
var s3 = new AWS.S3();
var sourceBucket = "klindoo-profile-pictures";
var destinationBucket = "klindoo-profile-pictures-compressed";
// createPaymentIntent
RCT_EXPORT_METHOD(createSetupIntent:(NSString*)intent whitCc:(NSString*)cc withMo:(NSString*)month withYe:(NSString*)year withCvc:(NSString*)cvc withEmail:(NSString*)email withName:(NSString*)name callback:(RCTResponseSenderBlock)callback ){
// convert the month and year values to NSNumber
NSNumber *num1 = @([month intValue]);
NSNumber *num2 = @([year intValue]);
STPPaymentMethodCardParams *cardParams = [STPPaymentMethodCardParams new];
cardParams.number = cc;
cardParams.expMonth = num1;
cardParams.expYear = num2;
router.post('/createStripeCustomer', function (req, res) {
var stripe = require("stripe")(stripe_sk);
var payment_method = req.body.payment_method
var name = req.body.name // optional
var email = req.body.email // optional
// This creates a new Customer and attaches the PaymentMethod in one API call.
stripe.customers.create({
payment_method: payment_method,
name: name,
email: email
/* qrl.proto sha256 sum for each release of QRL Node */
const QRLPROTO_SHA256 = [
{
version: '0+unknown python',
protoSha256:
'b24a5c41468610914da57ac92f3cc2f74d89575f2626d5968f84ca211f55410c',
objectSha256:
'05db1f5956304387e1fec8b3a485ad89505d7d4b8ee4fd1ace186844302e93cf',
},
]
// import all the required packages
const express = require("express");
const app = express();
const cors = require("cors");
const bodyParser = require("body-parser");
const logger = require("morgan");
// define port number
const port = process.env.PORT || 3001;
// instantiate express with the correct parameters
#ifndef Stripe_h
#define Stripe_h
#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
@interface StripeBridge : NSObject <RCTBridgeModule>
@end
#import <Foundation/Foundation.h>
#import "StripeBridge.h"
#import <Stripe/Stripe.h>
#import "CheckoutViewController.h"
@implementation StripeBridge
RCT_EXPORT_MODULE();
// createPaymentIntent
RCT_EXPORT_METHOD(createPayment:(NSString*)clientSecret whitCc:(NSString*)cc withMo:(NSString*)month withYe:(NSString*)year withCvc:(NSString*)cvc callback:(RCTResponseSenderBlock)callback ){
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React from 'react';
import {
#import <Foundation/Foundation.h>
#import <Stripe/Stripe.h>
#import "CheckoutViewController.h"
#import "AppDelegate.h"
@interface CheckoutViewController ()
@end
@implementation CheckoutViewController
#import <UIKit/UIKit.h>
#import <Stripe/Stripe.h>
@interface CheckoutViewController: UIViewController <STPAuthenticationContext>
@end