Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions blockchain_integration/pi_network/payment_gateways/square.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import squareconnect


class SquarePaymentGateway:
def __init__(self, access_token):
self.access_token = access_token
Expand All @@ -8,12 +9,9 @@ def __init__(self, access_token):
def create_payment(self, amount, currency):
transaction_api = squareconnect.TransactionsApi()
request_body = {
'amount_money': {
'amount': int(amount * 100),
'currency_code': currency
},
'payment_method_types': ['CARD'],
'idempotency_key': squareconnect.util.random_string(32)
"amount_money": {"amount": int(amount * 100), "currency_code": currency},
"payment_method_types": ["CARD"],
"idempotency_key": squareconnect.util.random_string(32),
}
response = transaction_api.create_transaction(request_body)
return response