42 lines
793 B
Python
Executable File
42 lines
793 B
Python
Executable File
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
|
|
|