L
L
ldevyataykina2017-06-20 18:06:56
Python
ldevyataykina, 2017-06-20 18:06:56

How to automate payments using Yandex Money API and Python?

I'm trying to make a payment from wallet to wallet and to phone in my application.

def wallet_payments(access_token, ym_account, total, api):
    wallet = Wallet(access_token)
    request_options = {
        "pattern_id": "p2p",
        "to": ym_account,
        "amount_due": total,
        "comment": "test payment comment from yandex-money-python",
        "message": "test payment message from yandex-money-python",
        "label": "testPayment",
        "test_payment": True,
        "test_result": "success"
    }

    request_result = api.request(request_options)
    process_payment = api.process({
        "request_id": request_result['request_id'],
        "money_source": "wallet",
        "ext_auth_success_uri": "http://www.omirussia.ru/",
        "ext_auth_fail_uri": "https://money.yandex.ru/actions",
        #"test_payment": True
    })
    return process_payment['status']

money_source
Based on the documentation, you must specify the payment method as an argument . If I specify "wallet" , then I get "money_source_not_available"
If I specify an argument from request_result that is equal then returns additional operations are required to make a payment related to a bank card. But since the payment is made from wallet to wallet, these arguments are not needed. So the question is how the `money_source` argument should look like
"money_source": request_result['money_source']'money_source': {'payment-card': {}}
ext_auth_required

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2017-06-20
@dimonchik2013

debug add

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question