-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eccaf92
commit 166a6a6
Showing
504 changed files
with
40,097 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import stripe | ||
from flask import Flask | ||
from flask import request | ||
from flask import json | ||
|
||
app = Flask(__name__) | ||
|
||
#1 | ||
@app.route('/pay', methods=['POST']) | ||
def pay(): | ||
|
||
#2 | ||
# Set this to your Stripe secret key (use your test key!) | ||
stripe.api_key = "sk_test_4HKKLEaGa6YweA50gknGDYEf" | ||
|
||
#3 | ||
# Parse the request as JSON | ||
json = request.get_json(force=True) | ||
|
||
# Get the credit card details | ||
token = json['stripeToken'] | ||
amount = json['amount'] | ||
description = json['description'] | ||
|
||
# Create the charge on Stripe's servers - this will charge the user's card | ||
try: | ||
#4 | ||
charge = stripe.Charge.create( | ||
amount=amount, | ||
currency="usd", | ||
card=token, | ||
description=description | ||
) | ||
except stripe.CardError, e: | ||
# The card has been declined | ||
pass | ||
|
||
#5 | ||
return "Success!" | ||
|
||
if __name__ == '__main__': | ||
# Set as 0.0.0.0 to be accessible outside your local machine | ||
app.run(debug=True, host= '0.0.0.0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import braintree | ||
import stripe | ||
from flask import Flask | ||
from flask import request | ||
from flask import json | ||
|
||
braintree.Configuration.configure( | ||
braintree.Environment.Sandbox, | ||
'8vcr8hbq5yknmx7p', | ||
'68wxydkzwpxms2vp', | ||
'3ff43ddfcc2e2b97718917952d19c070' | ||
) | ||
app = Flask(__name__) | ||
|
||
@app.route("/client_token", methods=["GET"]) | ||
def client_token(): | ||
return braintree.ClientToken.generate() | ||
@app.route("/checkout", methods=["POST"]) | ||
def create_purchase(): | ||
# def f(nonce_from_the_client): | ||
# nonce_from_the_client = request.form["sandbox_4mpg9vyr_8vcr8hbq5yknmx7p"] | ||
# Use payment method nonce here... | ||
json = request.get_json(force=True) | ||
nonce = json["payment_method_nonce"] | ||
ammount = json["amount"] | ||
result = braintree.Transaction.sale({ | ||
"amount": ammount, | ||
"payment_method_nonce": nonce, | ||
"options": { | ||
"submit_for_settlement": True | ||
} | ||
}) | ||
if result.is_success: | ||
print("success!: " + result.transaction.id) | ||
elif result.transaction: | ||
print("Error processing transaction:") | ||
print(" code: " + result.transaction.processor_response_code) | ||
print(" text: " + result.transaction.processor_response_text) | ||
else: | ||
for error in result.errors.deep_errors: | ||
print("attribute: " + error.attribute) | ||
print(" code: " + error.code) | ||
print(" message: " + error.message) | ||
return "success" | ||
|
||
#1 | ||
@app.route('/pay', methods=['POST']) | ||
def pay(): | ||
|
||
#2 | ||
# Set this to your Stripe secret key (use your test key!) | ||
stripe.api_key = "sk_test_4HKKLEaGa6YweA50gknGDYEf" | ||
|
||
#3 | ||
# Parse the request as JSON | ||
json = request.get_json(force=True) | ||
|
||
# Get the credit card details | ||
token = json['stripeToken'] | ||
amount = json['amount'] | ||
description = json['description'] | ||
|
||
# Create the charge on Stripe's servers - this will charge the user's card | ||
try: | ||
#4 | ||
charge = stripe.Charge.create( | ||
amount=amount, | ||
currency="usd", | ||
card=token, | ||
description=description | ||
) | ||
except stripe.CardError, e: | ||
# The card has been declined | ||
pass | ||
|
||
#5 | ||
return "Success!" | ||
|
||
if __name__ == '__main__': | ||
# Set as 0.0.0.0 to be accessible outside your local machine | ||
app.run(debug=True, host= '0.0.0.0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Uncomment the next line to define a global platform for your project | ||
# platform :ios, '9.0' | ||
|
||
target 'e-shop' do | ||
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks | ||
use_frameworks! | ||
#pod 'Stripe/ApplePay' | ||
#pod 'Stripe' | ||
pod "SwiftSpinner" | ||
pod 'Braintree', '~> 3.9' | ||
|
||
# Pods for e-shop | ||
|
||
target 'e-shopTests' do | ||
inherit! :search_paths | ||
# Pods for testing | ||
end | ||
|
||
target 'e-shopUITests' do | ||
inherit! :search_paths | ||
# Pods for testing | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
PODS: | ||
- Braintree (3.9.9): | ||
- Braintree/API (= 3.9.9) | ||
- Braintree/Coinbase (= 3.9.9) | ||
- Braintree/Drop-In (= 3.9.9) | ||
- Braintree/Payments (= 3.9.9) | ||
- Braintree/PayPal (= 3.9.9) | ||
- Braintree/UI (= 3.9.9) | ||
- Braintree/Venmo (= 3.9.9) | ||
- Braintree/API (3.9.9) | ||
- Braintree/Coinbase (3.9.9): | ||
- Braintree/API | ||
- Braintree/Drop-In (3.9.9): | ||
- Braintree/API | ||
- Braintree/Coinbase | ||
- Braintree/Payments | ||
- Braintree/PayPal | ||
- Braintree/UI | ||
- Braintree/Venmo | ||
- Braintree/Payments (3.9.9): | ||
- Braintree/API | ||
- Braintree/Coinbase | ||
- Braintree/PayPal | ||
- Braintree/Venmo | ||
- Braintree/PayPal (3.9.9): | ||
- Braintree/API | ||
- Braintree/UI | ||
- Braintree/UI (3.9.9): | ||
- Braintree/API | ||
- Braintree/Venmo (3.9.9): | ||
- Braintree/API | ||
- SwiftSpinner (1.5.0) | ||
|
||
DEPENDENCIES: | ||
- Braintree (~> 3.9) | ||
- SwiftSpinner | ||
|
||
SPEC CHECKSUMS: | ||
Braintree: a9d35b7d5a8d76267adcb5795d32c20ca5f39a99 | ||
SwiftSpinner: 4c058c7a1d6b444dd2e1d70988ead40783097133 | ||
|
||
PODFILE CHECKSUM: f9c29c30105959c35827399e9176ba1f78769ee6 | ||
|
||
COCOAPODS: 1.3.1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
Pods/Braintree/Braintree/API/@Public/BTAppSwitchingDelegate.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
Pods/Braintree/Braintree/API/@Public/BTApplePayPaymentMethod.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
Pods/Braintree/Braintree/API/@Public/BTCardPaymentMethod.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.