A package for initiating payments via the Stitch API
Project description
stitch-money-api
A Python package for processing digitial wallets payments via the Stitch API. For the complete integration guide, visit docs.stitch.money.
Installation
$ pip3 install stitch-money-api
Usage
Payment Initation
from pyramid.view import view_config
from pyramid.response import Response
from stitch.utils.types import Wallet, Currency, Transaction
import json
import uuid
@view_config(route_name='create', request_method='POST', renderer='json')
def create_apple_pay_payment(request) -> Transaction:
data = request.json_body
payment_token = data.get('payment_token')
nonce = str(uuid.uuidv4())
quantity = 1
currency = Currency.ZAR
reference = "StitchTest"
transaction = sdk.create(
Wallet.APPLE_PAY,
payment_token,
quantity,
currency,
nonce,
reference
)
return transaction
Merchant Verification (Web Only)
from pyramid.view import view_config
from pyramid.response import Response
from stitch.utils.types import Wallet, Currency, Session
import json
import uuid
@view_config(route_name='verify', request_method='POST', renderer='json')
def create_samsung_pay_payment(request) -> Session:
data = request.json_body
verification_url = data.get('verification_url') # 'https://apple-pay-gateway.apple.com/paymentservices/startSession'
initiative_context = data.get('initiative_context') # secure.stitch.money (FQDN)
displayName = "Stitch"
session = sdk.verify(
Wallet.APPLE_PAY,
quantity,
currency,
verification_url
displayName,
initiative_context
)
return session
License
The stitch-money-api package is open source and available under the MIT license. See the LICENSE file for more information.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stitch_money_api-1.0.1.tar.gz
(7.6 kB
view hashes)
Built Distribution
Close
Hashes for stitch_money_api-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 893286ecd70a2ecd43aac97835444b27ecd71ba385b735f7345fc6d18719890f |
|
MD5 | c5b7dd224b1f0e04cd75c49527319744 |
|
BLAKE2b-256 | 34fb6cd441716e65d8b4353e2b9d00e705575d0f6635d7d5898fff7dad1138f7 |