Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe sync transactions #149

Open
MichalNemec opened this issue Sep 24, 2024 · 0 comments
Open

Stripe sync transactions #149

MichalNemec opened this issue Sep 24, 2024 · 0 comments

Comments

@MichalNemec
Copy link

Hello,
I have

om_account_accountant
on_account_asset
om_account_budget
om_account_daily_reports
om_account followup
om_fiscal_year
om_recurring_payments

and also enabled payment_stripe. Configured PK SK and webhook to https://domain/payment/stripe/webhook with these events:

'payment_intent.processing',
    'payment_intent.amount_capturable_updated',
    'payment_intent.succeeded',
    'payment_intent.payment_failed',
    'setup_intent.succeeded',
    'charge.refunded',
    'charge.refund.updated',

when i have transaction done on custom website, its shown in stripe, webhook is sent, but i get this in log:

2024-09-24 11:38:33,214 23 INFO odoo odoo.addons.payment_stripe.controllers.main: Notification received from Stripe with data:
{'api_version': '2019-05-16',
 'created': 1727177912,
 'data': {'object': {'amount': 12500,
                     'amount_capturable': 0,
                     'amount_details': {'tip': {}},
                     'amount_received': 12500,
                     'application': None,
                     'application_fee_amount': None,
                     'automatic_payment_methods': {'allow_redirects': 'always',
                                                   'enabled': True},
                     'canceled_at': None,
                     'cancellation_reason': None,
                     'capture_method': 'automatic_async',
                     'charges': {'data': [{'amount': 12500,
                                           'amount_captured': 12500,
                                           'amount_refunded': 0,
                                           'application': None,
                                           'application_fee': None,
                                           'application_fee_amount': None,
                                           'balance_transaction': None,
                                           'billing_details': {'address': {'city': None,
                                                                           'country': 'GB',
                                                                           'line1': None,
                                                                           'line2': None,
                                                                           'postal_code': 'BD1 '
                                                                                          '1AF',
                                                                           'state': None},
                                                               'email': 'mymail@domain.com',
                                                               'name': None,
                                                               'phone': None},
                                           'calculated_statement_descriptor': 'DESC',
                                           'captured': True,
                                           'created': 1727177912,
                                           'currency': 'usd',
                                           'customer': None,
                                           'description': 'Donation',
                                           'destination': None,
                                           'dispute': None,
                                           'disputed': False,
                                           'failure_balance_transaction': None,
                                           'failure_code': None,
                                           'failure_message': None,
                                           'fraud_details': {},
                                           'id': 'ch_3Q2X4LACGTZBX2UF1Qit65so',
                                           'invoice': None,
                                           'livemode': False,
                                           'metadata': {},
                                           'object': 'charge',
                                           'on_behalf_of': None,
                                           'order': None,
                                           'outcome': {'network_status': 'approved_by_network',
                                                       'reason': None,
                                                       'risk_level': 'normal',
                                                       'risk_score': 15,
                                                       'seller_message': 'Payment '
                                                                         'complete.',
                                                       'type': 'authorized'},
                                           'paid': True,
                                           'payment_intent': 'pi_3Q2X4LACGTZBX2UF1cbeIUN9',
                                           'payment_method': 'pm_1Q2X4eACGTZBX2UFyC1ZeGH6',
                                           'payment_method_details': {'card': {'amount_authorized': 12500,
                                                                               'authorization_code': None,
                                                                               'brand': 'mastercard',
                                                                               'checks': {'address_line1_check': None,
                                                                                          'address_postal_code_check': 'pass',
                                                                                          'cvc_check': 'pass'},
                                                                               'country': 'US',
                                                                               'exp_month': 3,
                                                                               'exp_year': 2030,
                                                                               'extended_authorization': {'status': 'disabled'},
                                                                               'fingerprint': 'yfAXy2MoUuTNc3h6',
                                                                               'funding': 'credit',
                                                                               'incremental_authorization': {'status': 'unavailable'},
                                                                               'installments': None,
                                                                               'last4': '4444',
                                                                               'mandate': None,
                                                                               'multicapture': {'status': 'unavailable'},
                                                                               'network': 'mastercard',
                                                                               'network_token': {'used': False},
                                                                               'overcapture': {'maximum_amount_capturable': 12500,
                                                                                               'status': 'unavailable'},
                                                                               'three_d_secure': None,
                                                                               'wallet': None},
                                                                      'type': 'card'},
                                           'radar_options': {},
                                           'receipt_email': None,
                                           'receipt_number': None,
                                           'receipt_url': 'https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xUTF2aHpBQ0dUWkJYMlVGKLjJyrcGMgazqYZcUWA6LBbBT9Rh3CX5IT-iJmW8yq7iIEE0GUbFd1iHlVvH1gME9RTeotmINx9TbEpK',
                                           'refunded': False,
                                           'refunds': {'data': [],
                                                       'has_more': False,
                                                       'object': 'list',
                                                       'total_count': 0,
                                                       'url': '/v1/charges/ch_3Q2X4LACGTZBX2UF1Qit65so/refunds'},
                                           'review': None,
                                           'shipping': None,
                                           'source': None,
                                           'source_transfer': None,
                                           'statement_descriptor': None,
                                           'statement_descriptor_suffix': None,
                                           'status': 'succeeded',
                                           'transfer_data': None,
                                           'transfer_group': None}],
                                 'has_more': False,
                                 'object': 'list',
                                 'total_count': 1,
                                 'url': '/v1/charges?payment_intent=pi_3Q2X4LACGTZBX2UF1cbeIUN9'},
                     'client_secret': 'pi_3Q2X4LACGTZBX2UF1cbeIUN9_secret_1Zgl0eiiFcHipnvlKjmVJvDmc',
                     'confirmation_method': 'automatic',
                     'created': 1727177893,
                     'currency': 'usd',
                     'customer': None,
                     'description': 'Donation',
                     'id': 'pi_3Q2X4LACGTZBX2UF1cbeIUN9',
                     'invoice': None,
                     'last_payment_error': None,
                     'latest_charge': 'ch_3Q2X4LACGTZBX2UF1Qit65so',
                     'livemode': False,
                     'metadata': {},
                     'next_action': None,
                     'object': 'payment_intent',
                     'on_behalf_of': None,
                     'payment_method': 'pm_1Q2X4eACGTZBX2UFyC1ZeGH6',
                     'payment_method_configuration_details': None,
                     'payment_method_options': {'card': {'installments': None,
                                                         'mandate_options': None,
                                                         'network': None,
                                                         'request_three_d_secure': 'automatic'}},
                     'payment_method_types': ['card'],
                     'processing': None,
                     'receipt_email': None,
                     'review': None,
                     'setup_future_usage': None,
                     'shipping': None,
                     'source': None,
                     'statement_descriptor': None,
                     'statement_descriptor_suffix': None,
                     'status': 'succeeded',
                     'transfer_data': None,
                     'transfer_group': None}},
 'id': 'evt_3Q2X4LACGTZBX2UF1Cxwkbz8',
 'livemode': False,
 'object': 'event',
 'pending_webhooks': 1,
 'request': {'id': 'req_DF6QKK8BTbtc63',
             'idempotency_key': 'e5099cff-cd8b-4d13-b42a-744c55b278d1'},
 'type': 'payment_intent.succeeded'}
2024-09-24 11:38:33,216 23 ERROR odoo odoo.addons.payment_stripe.controllers.main: unable to handle the notification data; skipping to acknowledge
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/payment_stripe/controllers/main.py", line 89, in stripe_webhook
    tx_sudo = request.env['payment.transaction'].sudo()._get_tx_from_notification_data(
  File "/usr/lib/python3/dist-packages/odoo/addons/payment_stripe/models/payment_transaction.py", line 348, in _get_tx_from_notification_data
    raise ValidationError(
odoo.exceptions.ValidationError: Stripe: No transaction found matching reference Donation.

Question: how can i have proper sync of stripe stuff inside accounting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant