Reputation: 11619
I have a simple paypal buy button. The user is redirected to paypal gateway to pay, where he can choose the number of items he wants to buy.
My problem is that I can't see the number of items (that the users entered) in the IPN variables on my server, the variable num_cart_items
is always 1.
One way to solve my problem would be to disable this possibility for the user to choose the amount of item he wants to buy, but I am not sure it is possible. Or to deduce the number of item from the price, but this is more a hack.
EDIT
Here is the object that I receive on my django server (using django-paypal, in the payment_was_successful signal), as you can see the query
property has quantity1
, but not the object itself:
{'created_at': datetime.datetime(2014, 6, 27, 10, 7, 50, 798488, tzinfo=<UTC>),
'last_name': u'LASTNAME',
'shipping_method': u'',
'query': u'mc_gross=3.00&protection_eligibility=Ineligible&item_number1=&payer_id=Q6E6KSFDPM3U6&tax=0.00&payment_date=03%3A06%3A57+Jun+27%2C+2014+PDT&payment_status=Completed&charset=windows-1252&mc_shipping=0.00&mc_handling=0.00&first_name=FIRSTNAME&mc_fee=0.35¬ify_version=3.8&custom=%7B%22user%22%3A%22username%22%2C%22location%22%3A%7B%22x%22%3A202%2C%22y%22%3A223%7D%7D&payer_status=verified&business=email-facilitator%40gmail.com&num_cart_items=1&mc_handling1=0.00&verify_sign=SECRET_CODE&payer_email=email%40gmail.com&mc_shipping1=0.00&tax1=0.00&btn_id1=2965595&txn_id=2KW31663CC752394K&payment_type=instant&last_name=LASTNAME&item_name1=Romanescoins&receiver_email=email-facilitator%40gmail.com&payment_fee=&quantity1=3&receiver_id=CUMWR6T2ARF36&txn_type=cart&mc_gross_1=3.00&mc_currency=EUR&residence_country=FR&test_ipn=1&transaction_subject=%7B%22user%22%3A%22username%22%2C%22location%22%3A%7B%22x%22%3A202%2C%22y%22%3A223%7D%7D&payment_gross=&ipn_track_id=a48170aadb705',
'outstanding_balance': None,
'subscr_id': u'',
'auction_multi_item': None,
'item_name': u'',
'case_id': u'',
'address_name': u'',
'transaction_entity': u'',
'from_view': u'',
'auction_closing_date': None,
'password': u'',
'auction_buyer_id': u'',
'address_country_code': u'',
'address_city': u'',
'address_status': u'',
'auth_exp': u'',
'payer_email': u'[email protected]',
'mc_gross': Decimal('3.00'),
'reattempt': u'',
'handling_amount': None,
'reason_code': u'',
'remaining_settle': None,
'invoice': u'',
'address_state': u'',
'num_cart_items': 1,
'address_country': u'',
'payer_business_name': u'',
'first_name': u'FIRSTNAME',
'mc_shipping': Decimal('0.00'),
'flag_info': u'',
'for_auction': None,
'profile_status': u'',
'item_number': u'',
'business': u'[email protected]',
'settle_currency': u'',
'shipping': None,
'amount': None,
'currency_code': u'',
'txn_id': u'2KW31663CC752394K',
'payment_status': u'Completed',
'payment_gross': None,
'retry_at': None,
'exchange_rate': None,
'residence_country': u'FR',
'payer_status': u'verified',
'address_street': u'',
'initial_payment_amount': None,
'auth_amount': None,
'custom': u'{"user":"username","location":{"x":202,"y":223}}',
'notify_version': Decimal('3.8'),
'period_type': u'',
'settle_amount': None,
'recurring': u'',
'pending_reason': u'',
'username': u'',
'tax': Decimal('0.00'),
'memo': u'',
'payer_id': u'Q6E6KSFDPM3U6',
'flag': False,
'mc_handling': Decimal('0.00'),
'address_zip': u'',
'mc_fee': Decimal('0.35'),
'payment_type': u'instant',
'amount1': None,
'recurring_payment_id': u'',
'protection_eligibility': u'Ineligible',
'receiver_email': u'[email protected]',
'_state': <django.db.models.base.ModelState object at 0x2248550>,
'updated_at': datetime.datetime(2014, 6, 27, 10, 7, 50, 798510, tzinfo=<UTC>),
'time_created': None,
'mc_currency': u'EUR',
'option_name1': u'',
'subscr_date': None,
'option_name2': u'',
'txn_type': u'cart',
'recur_times': None,
'auth_status': u'',
'id': 90,
'rp_invoice_id': u'',
'payment_cycle': u'',
'subscr_effective': None,
'charset': u'windows-1252',
'parent_txn_id': u'',
'auth_id': u'',
'transaction_subject': u'{"user":"username","location":{"x":202,"y":223}}',
'contact_phone': u'',
'product_name': u'',
'test_ipn': True,
'receiver_id': u'CUMWR6T2ARF36',
'payment_date': datetime.datetime(2014, 6, 27, 3, 6, 57, tzinfo=<LocalTimezone>),
'amount_per_cycle': None,
'period2': u'',
'period3': u'',
'period1': u'',
'verify_sign': u'SECRET_CODE',
'flag_code': u'',
'ipaddress': '127.0.0.1',
'response': u'VERIFIED',
'product_type': u'',
'receipt_id': u'',
'amount3': None,
'amount2': None,
'next_payment_date': None,
'mc_amount3': None,
'mc_amount2': None,
'mc_amount1': None,
'case_creation_date': None,
'case_type': u'',
'quantity': None}
Upvotes: 1
Views: 91
Reputation: 310885
num_cart_items
is the number of distinct items in the cart. The quantity of each item is in quantity1,
quantity2
, etc, for a shopping-cart transaction, otherwise in quantity
.
This is all documented.
Upvotes: 1