Example #1
0
def simple_checkout(request):
    order = Order.objects.get(user=request.user, ordered=False)
    print(request.user)
    snap = Snap(
        is_production=False,
        server_key='',
        client_key='',
    )
    timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    transaction_token = snap.create_transaction_token({
        "transaction_details": {
            "order_id": str(request.user) + "-order-id-python-" + timestamp,
            "gross_amount": order.get_fin_total()
        },
        "credit_card": {
            "secure": True
        }
    })
    order_id = str(request.user) + "-order-id-python-" + timestamp
    order.iden = order_id
    order.save()
    context = {
        'token': transaction_token,
        'client_key': snap.api_config.client_key,
        'order': order
    }

    return render(request, 'payment.html', context)
Example #2
0
def simple_checkout():
    snap = Snap(
        is_production=False,
        server_key='SB-Mid-server-GwUP_WGbJPXsDzsNEBRs8IYA',
        client_key='SB-Mid-client-61XuGAwQ8Bj8LxSS',
    )
    timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    transaction_token = snap.create_transaction_token({
        "transaction_details": {
            "order_id": "order-id-python-"+timestamp,
            "gross_amount": 200000
        }, "credit_card":{
            "secure" : True
        }
    })
    return render_template('simple_checkout.html', 
        token = transaction_token, 
        client_key = snap.api_config.client_key)
Example #3
0
def simple_checkout():
    snap = Snap(is_production=False,
                server_key=SERVER_KEY,
                client_key=CLIENT_KEY)
    timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    transaction_token = snap.create_transaction_token({
        "transaction_details": {
            "order_id": "order-id-python-" + timestamp,
            "gross_amount": 200000
        },
        "credit_card": {
            "secure": True
        }
    })

    return render_template('simple_checkout.html',
                           token=transaction_token,
                           client_key=snap.api_config.client_key)
def simple_checkout():
    snap = Snap(
        is_production=False,
        server_key='SB-Mid-server-GwUP_WGbJPXsDzsNEBRs8IYA',
        client_key='SB-Mid-client-61XuGAwQ8Bj8LxSS',
    )
    transaction_token = snap.create_transaction_token({
        "transaction_details": {
            "order_id": str(uuid.uuid4()),
            "gross_amount": 200000
        },
        "credit_card": {
            "secure": True
        }
    })
    return render_template('simple_checkout.html',
                           token=transaction_token,
                           client_key=snap.api_config.client_key)