first commit
This commit is contained in:
41
app/create/views.py
Normal file
41
app/create/views.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from flask import jsonify
|
||||
import stripe
|
||||
from app.create import create
|
||||
|
||||
|
||||
@create.route("/create/product", methods=["GET"])
|
||||
def create_product():
|
||||
"""
|
||||
Creates a product
|
||||
"""
|
||||
create_a_product = stripe.Product.create(
|
||||
name="Oil",
|
||||
active=True,
|
||||
description="One Gallon of Oil",
|
||||
shippable=False,
|
||||
)
|
||||
return jsonify({
|
||||
"ok": True,
|
||||
'info': create_a_product,
|
||||
}), 200
|
||||
|
||||
|
||||
|
||||
|
||||
@create.route("/create/price", methods=["GET"])
|
||||
def create_product_price():
|
||||
"""
|
||||
Sets the price of the product
|
||||
"""
|
||||
|
||||
create_price = stripe.Price.create(
|
||||
product_data={"name": "Oil"},
|
||||
unit_amount=350,
|
||||
currency="usd",
|
||||
)
|
||||
|
||||
return jsonify({
|
||||
"ok": True,
|
||||
'info': create_price,
|
||||
}), 200
|
||||
|
||||
Reference in New Issue
Block a user