This question has been flagged
1384 Views

I've been trying to get Swedbank Pay to work. I've been looking at PayPal, Buckaroo and some other. I can not find the correct syntax for the prize in the web store.

        data = json.dumps({
            "payment": {
                "operation": "Purchase",
                "intent": "Authorization",
                "currency": tx.currency_id.name,
                "prices": [{
                    "type": "CreditCard",
                    "amount": int(tx.amount * 100),
                    "vatAmount": vatAmount,
                }
                ],
                "description": "Test Purchase",
                "userAgent": 'USERAGENT=%s' % request.httprequest.user_agent.string,
                "language": "sv-SE",
                "urls": {
                    "completeUrl": '%s/payment/swedbankpay/verify' % request.env['ir.config_parameter'].sudo().get_param('web.base.url'),
                    "cancelUrl": '%s/shop/payment' % request.env['ir.config_parameter'].sudo().get_param('web.base.url'),
                    # ~ "logoUrl":  '%s/logo500.png' % request.env['ir.config_parameter'].sudo().get_param('web.base.url'),
                },
                "payeeInfo": {
                    "payeeId": tx.acquirer_id.swedbankpay_merchant_id,
                    "payeeReference": tx.reference,
                    # ~ "payeeReference": tx.acquirer_id.swedbankpay_account_nr,
                    "swedbankpayKey": tx.acquirer_id.swedbankpay_key,
                    # ~ "payeeName": "xxxxx",
                    # ~ "productCategory": "xxxxx",
                    "orderReference": tx.reference,
                    # ~ "subsite": request.env['ir.config_parameter'].sudo().get_param('web.base.url'),
                }
            }
        })

* * * * * * * * * * * * * *

The result of above is:

66. data = json-dump = {"payment": {"operation": "Purchase", "intent": "Authorization", "currency": false, "prices": [{"type": "CreditCard", "amount": 0, "vatAmount": 0}], "description": "Test Purchase", "userAgent": "USERAGENT=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0", "language": "sv-SE", "urls": {"completeUrl": "http://localhost:8069/payment/swedbankpay/verify", "cancelUrl": "http://localhost:8069/shop/payment"}, "payeeInfo": {"payeeId": false, "payeeReference": false, "swedbankpayKey": "example_swedbank_paykey_example", "orderReference": false}}}


* * * * * * * * *

Problem: Amount = 0, should be 11.000-something. (This is from the sample store. No lie data.)

Currency = false. Should be SEK.

Avatar
Discard